All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak R Varma <mh12gx2825@gmail.com>
To: Sumera Priyadarsini <sylphrenadin@gmail.com>
Cc: outreachy-kernel@googlegroups.com, Ian Abbott <abbotti@mev.co.uk>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [Outreachy kernel] [PATCH] staging: comedi: Use sysfs_emit for show(device *...) functions
Date: Mon, 19 Oct 2020 00:15:50 +0530	[thread overview]
Message-ID: <20201018184550.GA53720@ubuntu204> (raw)
In-Reply-To: <CACAkLuoOgLe5pH5WsKqybZ92DcHiKM0eOCPuqm7wKMkeOC7s5Q@mail.gmail.com>

On Mon, Oct 19, 2020 at 12:01:24AM +0530, Sumera Priyadarsini wrote:
> On Sun, 18 Oct, 2020, 11:40 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/comedi/comedi_fops.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/comedi/comedi_fops.c
> > b/drivers/staging/comedi/comedi_fops.c
> > index d99231c737fb..5b8ba0c84a8e 100644
> > --- a/drivers/staging/comedi/comedi_fops.c
> > +++ b/drivers/staging/comedi/comedi_fops.c
> > @@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device
> > *csdev,
> >         mutex_unlock(&dev->mutex);
> >
> >         comedi_dev_put(dev);
> > -       return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > +       return sysfs_emit(buf, "%u\n", size);
> >  }
> >
> >  static ssize_t max_read_buffer_kb_store(struct device *csdev,
> > @@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(struct device
> > *csdev,
> >         mutex_unlock(&dev->mutex);
> >
> >         comedi_dev_put(dev);
> > -       return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > +       return sysfs_emit(buf, "%u\n", size);
> >  }
> >
> >  static ssize_t read_buffer_kb_store(struct device *csdev,
> > @@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(struct device
> > *csdev,
> >         mutex_unlock(&dev->mutex);
> >
> >         comedi_dev_put(dev);
> > -       return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > +       return sysfs_emit(buf, "%u\n", size);
> >  }
> >
> >  static ssize_t max_write_buffer_kb_store(struct device *csdev,
> > @@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct device
> > *csdev,
> >         mutex_unlock(&dev->mutex);
> >
> >         comedi_dev_put(dev);
> > -       return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > +       return sysfs_emit(buf, "%u\n", size);
> >  }
> >
> >  static ssize_t write_buffer_kb_store(struct device *csdev,
> > --
> > 2.25.1
> >
> 
> Hi Deepak,
> 
> I was just about to send a V2 for the previous patchset I sent which
> included this file as well. No issues since I've not sent it yet- I'll
> remove this file from my V2. But please give me a heads-up the next time so
> we are not working on the same files. :-)
> 
> Thanks, and regards,
> Sumera
> 

Sure. I should have informed you. My bad.
I also sent in patches for the other two files as well. So you can look
for other issues to fix.

Thanks.
Deepak.

> -- 
> > You received this message because you are subscribed to the Google Groups
> > "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/outreachy-kernel/20201018180954.GA39024%40ubuntu204
> > .
> >


  reply	other threads:[~2020-10-18 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18 18:09 [PATCH] staging: comedi: Use sysfs_emit for show(device *...) functions Deepak R Varma
2020-10-18 18:31 ` [Outreachy kernel] " Sumera Priyadarsini
2020-10-18 18:45   ` Deepak R Varma [this message]
2020-10-19  0:21     ` Helen Koike
2020-10-19  1:27       ` Deepak R Varma
2020-10-19  6:12         ` Sumera Priyadarsini

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=20201018184550.GA53720@ubuntu204 \
    --to=mh12gx2825@gmail.com \
    --cc=abbotti@mev.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=sylphrenadin@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.