From: Deepak R Varma <mh12gx2825@gmail.com>
To: Sven Van Asbroeck <thesven73@gmail.com>
Cc: outreachy-kernel@googlegroups.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] staging: fieldbus: Use sysfs_emit for show(device *...) functions
Date: Tue, 3 Nov 2020 01:58:05 +0530 [thread overview]
Message-ID: <20201102202805.GA63429@localhost> (raw)
In-Reply-To: <CAGngYiVKiRxDHi_7Hbfy6FViFkS_5dV66nkV-apRsEoZ1OmHzg@mail.gmail.com>
On Fri, Oct 23, 2020 at 09:40:25AM -0400, Sven Van Asbroeck wrote:
> Hi Deepak, thank you for the patch.
>
> There are many other sysfs show functions in this driver that can be converted
> to use sysfs_emit().
Hello Sven & Greg,
Is it okay for me to now change other show functions as suggested for
this driver and send another patch?
Just want to confirm since I will be sending the patches from the linux
next tree and for the staging driver.
Thank you.
./drv
>
> But, the perfect musn't be the enemy of the good:
>
> Reviewed-by: Sven Van Asbroeck <TheSven73@gmail.com>
>
> On Sun, Oct 18, 2020 at 2:26 PM Deepak R Varma <mh12gx2825@gmail.com> wrote:
> >
> > Convert snprintf calls in device show functions to sysfs_emit for
> > PAGE_SIZE buffer safety.
> > Warning generated by: scripts/coccinelle/api/device_attr_show.cocci
> >
> > Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> > ---
> > drivers/staging/fieldbus/dev_core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
> > index 1ba0234cc60d..698d7b479270 100644
> > --- a/drivers/staging/fieldbus/dev_core.c
> > +++ b/drivers/staging/fieldbus/dev_core.c
> > @@ -70,7 +70,7 @@ static ssize_t card_name_show(struct device *dev, struct device_attribute *attr,
> > * card_name was provided by child driver, could potentially be long.
> > * protect against buffer overrun.
> > */
> > - return snprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
> > + return sysfs_emit(buf, "%s\n", fb->card_name);
> > }
> > static DEVICE_ATTR_RO(card_name);
> >
> > --
> > 2.25.1
> >
prev parent reply other threads:[~2020-11-02 20:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-18 18:26 [PATCH] staging: fieldbus: Use sysfs_emit for show(device *...) functions Deepak R Varma
2020-10-23 13:40 ` Sven Van Asbroeck
2020-11-02 20:28 ` Deepak R Varma [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201102202805.GA63429@localhost \
--to=mh12gx2825@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=thesven73@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.