All of lore.kernel.org
 help / color / mirror / Atom feed
* [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
@ 2020-10-15 19:11 Sumera Priyadarsini
  2020-10-15 19:14 ` [Outreachy][PATCH 1/3] staging: fbtft: " Sumera Priyadarsini
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-15 19:11 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

The show() methods in device attributes should return the number of
bytes printed into the buffer which is the return value of scnprintf(). 
snprintf() returns the potential number of bytes that could be written
which may be greater than the actual length to be written.

This patchset is a series of trivial changes across the staging
directory to replace snprintf with scnprintf in the relevant files.
    
Sumera Priyadarsini (3):
  staging: fbtft: Replace snprintf() with scnprintf()
  staging: fieldbus: Replace snprintf() with scnprintf()
  staging: comedi: Replace snprintf() with scnprintf()

 drivers/staging/comedi/comedi_fops.c | 8 ++++----
 drivers/staging/fbtft/fbtft-sysfs.c  | 2 +-
 drivers/staging/fieldbus/dev_core.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Outreachy][PATCH 1/3] staging: fbtft: Replace snprintf() with scnprintf()
  2020-10-15 19:11 [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf() Sumera Priyadarsini
@ 2020-10-15 19:14 ` Sumera Priyadarsini
  2020-10-15 19:16 ` [Outreachy][PATCH 2/3] staging: fieldbus: " Sumera Priyadarsini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-15 19:14 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

The show_debug() method should return the number of bytes printed into the
buffer which is the return value of scnprintf(). snprintf() returns the
potential number of bytes that could be written which may be greater
than the actual length to be written.

Replace snprintf() with the safer scnprintf() in fbtft-sysfs.c.

Issue found with Coccinelle.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
---
 drivers/staging/fbtft/fbtft-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
index 26e52cc2de64..7df92db648d6 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -199,7 +199,7 @@ static ssize_t show_debug(struct device *device,
 	struct fb_info *fb_info = dev_get_drvdata(device);
 	struct fbtft_par *par = fb_info->par;
 
-	return snprintf(buf, PAGE_SIZE, "%lu\n", par->debug);
+	return scnprintf(buf, PAGE_SIZE, "%lu\n", par->debug);
 }
 
 static struct device_attribute debug_device_attr =
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Outreachy][PATCH 2/3] staging: fieldbus: Replace snprintf() with scnprintf()
  2020-10-15 19:11 [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf() Sumera Priyadarsini
  2020-10-15 19:14 ` [Outreachy][PATCH 1/3] staging: fbtft: " Sumera Priyadarsini
@ 2020-10-15 19:16 ` Sumera Priyadarsini
  2020-10-23 13:03   ` Sven Van Asbroeck
  2020-10-15 19:18 ` [Outreachy][PATCH 3/3] staging: comedi: " Sumera Priyadarsini
  2020-10-15 19:21 ` [Outreachy kernel] [Outreachy][PATCH 0/3] staging: " Matthew Wilcox
  3 siblings, 1 reply; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-15 19:16 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh, TheSven73

The card_name_show() method should return the number of bytes printed into
the buffer which is the return value of scnprintf(). snprintf() returns the
potential number of bytes that could be written which may be greater
than the actual length to be written.

Replace snprintf() with the safer scnprintf() in dev_core.c.

Issue found with Coccinelle.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@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..a0fcd87a1747 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 scnprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
 }
 static DEVICE_ATTR_RO(card_name);
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Outreachy][PATCH 3/3] staging: comedi: Replace snprintf() with scnprintf()
  2020-10-15 19:11 [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf() Sumera Priyadarsini
  2020-10-15 19:14 ` [Outreachy][PATCH 1/3] staging: fbtft: " Sumera Priyadarsini
  2020-10-15 19:16 ` [Outreachy][PATCH 2/3] staging: fieldbus: " Sumera Priyadarsini
@ 2020-10-15 19:18 ` Sumera Priyadarsini
  2020-10-16  9:14   ` Ian Abbott
  2020-10-15 19:21 ` [Outreachy kernel] [Outreachy][PATCH 0/3] staging: " Matthew Wilcox
  3 siblings, 1 reply; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-15 19:18 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh, hsweeten, abbotti

The show() methods should return the number of bytes printed into the
buffer which is the return value of scnprintf(). snprintf() returns the
potential number of bytes that could be written which may be greater
than the actual length to be written.

Replace snprintf() with the safer scnprintf() in comedi_fops.c.

Issue found with Coccinelle.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@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..c9ab36792f00 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 scnprintf(buf, PAGE_SIZE, "%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 scnprintf(buf, PAGE_SIZE, "%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 scnprintf(buf, PAGE_SIZE, "%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 scnprintf(buf, PAGE_SIZE, "%u\n", size);
 }
 
 static ssize_t write_buffer_kb_store(struct device *csdev,
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-15 19:11 [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf() Sumera Priyadarsini
                   ` (2 preceding siblings ...)
  2020-10-15 19:18 ` [Outreachy][PATCH 3/3] staging: comedi: " Sumera Priyadarsini
@ 2020-10-15 19:21 ` Matthew Wilcox
  2020-10-16  8:24   ` Greg KH
                     ` (2 more replies)
  3 siblings, 3 replies; 20+ messages in thread
From: Matthew Wilcox @ 2020-10-15 19:21 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: outreachy-kernel, gregkh

On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> The show() methods in device attributes should return the number of
> bytes printed into the buffer which is the return value of scnprintf(). 
> snprintf() returns the potential number of bytes that could be written
> which may be greater than the actual length to be written.

There's a big patchset just gone into 5.10 yesterday which adds a new
sysfs_emit() for show methods.  You probably want to use that instead
of scnprintf().


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-15 19:21 ` [Outreachy kernel] [Outreachy][PATCH 0/3] staging: " Matthew Wilcox
@ 2020-10-16  8:24   ` Greg KH
  2020-10-16  8:44   ` Sumera Priyadarsini
  2020-10-18  5:32   ` Deepak R Varma
  2 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2020-10-16  8:24 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: Matthew Wilcox, outreachy-kernel

On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > The show() methods in device attributes should return the number of
> > bytes printed into the buffer which is the return value of scnprintf(). 
> > snprintf() returns the potential number of bytes that could be written
> > which may be greater than the actual length to be written.
> 
> There's a big patchset just gone into 5.10 yesterday which adds a new
> sysfs_emit() for show methods.  You probably want to use that instead
> of scnprintf().

Yes, please do that instead, I will not take these as-is, sorry.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-15 19:21 ` [Outreachy kernel] [Outreachy][PATCH 0/3] staging: " Matthew Wilcox
  2020-10-16  8:24   ` Greg KH
@ 2020-10-16  8:44   ` Sumera Priyadarsini
  2020-10-18  5:32   ` Deepak R Varma
  2 siblings, 0 replies; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-16  8:44 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: outreachy-kernel, Greg KH

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

On Fri, 16 Oct, 2020, 12:51 AM Matthew Wilcox, <willy@infradead.org> wrote:

> On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > The show() methods in device attributes should return the number of
> > bytes printed into the buffer which is the return value of scnprintf().
> > snprintf() returns the potential number of bytes that could be written
> > which may be greater than the actual length to be written.
>
> There's a big patchset just gone into 5.10 yesterday which adds a new
> sysfs_emit() for show methods.  You probably want to use that instead
> of scnprintf().
>

Thanks for letting me know! I will revise and send a v2.

regards,
Sumera

>

[-- Attachment #2: Type: text/html, Size: 1282 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy][PATCH 3/3] staging: comedi: Replace snprintf() with scnprintf()
  2020-10-15 19:18 ` [Outreachy][PATCH 3/3] staging: comedi: " Sumera Priyadarsini
@ 2020-10-16  9:14   ` Ian Abbott
  2020-10-16  9:36     ` Sumera Priyadarsini
  2020-10-18 19:51     ` [Outreachy kernel] " Deepak R Varma
  0 siblings, 2 replies; 20+ messages in thread
From: Ian Abbott @ 2020-10-16  9:14 UTC (permalink / raw)
  To: Sumera Priyadarsini, outreachy-kernel; +Cc: gregkh, hsweeten

On 15/10/2020 20:18, Sumera Priyadarsini wrote:
> The show() methods should return the number of bytes printed into the
> buffer which is the return value of scnprintf(). snprintf() returns the
> potential number of bytes that could be written which may be greater
> than the actual length to be written.
> 
> Replace snprintf() with the safer scnprintf() in comedi_fops.c.
> 
> Issue found with Coccinelle.
> 
> Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>

The patch is fine, but there are a couple of problems.

1) Patches for "staging" should be Cc'ed to devel@driverdev.osuosl.org .

2) It appears to be part of a patch series, but I have no clue about the 
other patches in the series because I haven't seen them.  The patch 
doesn't look like it depends on any other patches in a series, so it 
should be a standalone patch, not part of a series.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy][PATCH 3/3] staging: comedi: Replace snprintf() with scnprintf()
  2020-10-16  9:14   ` Ian Abbott
@ 2020-10-16  9:36     ` Sumera Priyadarsini
  2020-10-18 19:51     ` [Outreachy kernel] " Deepak R Varma
  1 sibling, 0 replies; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-16  9:36 UTC (permalink / raw)
  To: Ian Abbott; +Cc: outreachy-kernel, Greg KH, hsweeten

[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]

On Fri, 16 Oct, 2020, 2:44 PM Ian Abbott, <abbotti@mev.co.uk> wrote:

> On 15/10/2020 20:18, Sumera Priyadarsini wrote:
> > The show() methods should return the number of bytes printed into the
> > buffer which is the return value of scnprintf(). snprintf() returns the
> > potential number of bytes that could be written which may be greater
> > than the actual length to be written.
> >
> > Replace snprintf() with the safer scnprintf() in comedi_fops.c.
> >
> > Issue found with Coccinelle.
> >
> > Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
>
> The patch is fine, but there are a couple of problems.
>
> 1) Patches for "staging" should be Cc'ed to devel@driverdev.osuosl.org .
>

My bad, I'll keep this in mind for future patches.


> 2) It appears to be part of a patch series, but I have no clue about the
> other patches in the series because I haven't seen them.  The patch
> doesn't look like it depends on any other patches in a series, so it
> should be a standalone patch, not part of a series.
>

I am not exactly sure why this happened, but now that you point it out, the
patches seem a bit disjoint in my mail as well. I think it's because I
Cc'ed the different patches differently. :(

The patch series comprised a series of changes across staging to replace
snprintf()  with scnprintf(). But I got a review about the recent
incorporation of 'sysfs_emit()' in the kernel and I should use that
instead, so I'll be sending a V2 shortly.

Thanks,
Sumera

-- 
> -=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
> -=( registered in England & Wales.  Regd. number: 02862268.  )=-
> -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
> -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
>

[-- Attachment #2: Type: text/html, Size: 3123 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-15 19:21 ` [Outreachy kernel] [Outreachy][PATCH 0/3] staging: " Matthew Wilcox
  2020-10-16  8:24   ` Greg KH
  2020-10-16  8:44   ` Sumera Priyadarsini
@ 2020-10-18  5:32   ` Deepak R Varma
  2020-10-18  5:38     ` Greg KH
  2 siblings, 1 reply; 20+ messages in thread
From: Deepak R Varma @ 2020-10-18  5:32 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Sumera Priyadarsini, outreachy-kernel, gregkh

On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > The show() methods in device attributes should return the number of
> > bytes printed into the buffer which is the return value of scnprintf(). 
> > snprintf() returns the potential number of bytes that could be written
> > which may be greater than the actual length to be written.
> 
> There's a big patchset just gone into 5.10 yesterday which adds a new
> sysfs_emit() for show methods.  You probably want to use that instead
> of scnprintf().
> 
Hello Matthew,
I am able to build my staging branch into 5.9.0-rc8 release. Can you
please suggest how can I get 5.10?

Thank you,
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/20201015192157.GC20115%40casper.infradead.org.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-18  5:32   ` Deepak R Varma
@ 2020-10-18  5:38     ` Greg KH
  2020-10-19  6:02       ` Deepak R Varma
  0 siblings, 1 reply; 20+ messages in thread
From: Greg KH @ 2020-10-18  5:38 UTC (permalink / raw)
  To: Deepak R Varma; +Cc: Matthew Wilcox, Sumera Priyadarsini, outreachy-kernel

On Sun, Oct 18, 2020 at 11:02:43AM +0530, Deepak R Varma wrote:
> On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> > On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > > The show() methods in device attributes should return the number of
> > > bytes printed into the buffer which is the return value of scnprintf(). 
> > > snprintf() returns the potential number of bytes that could be written
> > > which may be greater than the actual length to be written.
> > 
> > There's a big patchset just gone into 5.10 yesterday which adds a new
> > sysfs_emit() for show methods.  You probably want to use that instead
> > of scnprintf().
> > 
> Hello Matthew,
> I am able to build my staging branch into 5.9.0-rc8 release. Can you
> please suggest how can I get 5.10?

Pull from Linus's tree right now, or pull from linux-next.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] Re: [Outreachy][PATCH 3/3] staging: comedi: Replace snprintf() with scnprintf()
  2020-10-16  9:14   ` Ian Abbott
  2020-10-16  9:36     ` Sumera Priyadarsini
@ 2020-10-18 19:51     ` Deepak R Varma
  2020-10-18 20:35       ` Helen Koike
  1 sibling, 1 reply; 20+ messages in thread
From: Deepak R Varma @ 2020-10-18 19:51 UTC (permalink / raw)
  To: Ian Abbott; +Cc: Sumera Priyadarsini, outreachy-kernel, gregkh, hsweeten

On Fri, Oct 16, 2020 at 10:14:46AM +0100, Ian Abbott wrote:
> On 15/10/2020 20:18, Sumera Priyadarsini wrote:
> > The show() methods should return the number of bytes printed into the
> > buffer which is the return value of scnprintf(). snprintf() returns the
> > potential number of bytes that could be written which may be greater
> > than the actual length to be written.
> > 
> > Replace snprintf() with the safer scnprintf() in comedi_fops.c.
> > 
> > Issue found with Coccinelle.
> > 
> > Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> 
> The patch is fine, but there are a couple of problems.
> 
> 1) Patches for "staging" should be Cc'ed to devel@driverdev.osuosl.org .

Hi Ian,
Does this apply to ALL drivers under "staging" or only the comedi series 
drivers?

Thank you,
Deepak.

> 
> 2) It appears to be part of a patch series, but I have no clue about the
> other patches in the series because I haven't seen them.  The patch doesn't
> look like it depends on any other patches in a series, so it should be a
> standalone patch, not part of a series.
> 
> -- 
> -=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
> -=( registered in England & Wales.  Regd. number: 02862268.  )=-
> -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
> -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
> 
> -- 
> 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/825f5868-49f4-509d-638d-5fcab59c8f1a%40mev.co.uk.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] Re: [Outreachy][PATCH 3/3] staging: comedi: Replace snprintf() with scnprintf()
  2020-10-18 19:51     ` [Outreachy kernel] " Deepak R Varma
@ 2020-10-18 20:35       ` Helen Koike
  2020-10-18 21:31         ` Julia Lawall
  0 siblings, 1 reply; 20+ messages in thread
From: Helen Koike @ 2020-10-18 20:35 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Ian Abbott, Sumera Priyadarsini, outreachy-kernel, Greg KH, hsweeten

Hi Deepak and Ian,

On Sun, Oct 18, 2020 at 4:51 PM Deepak R Varma <mh12gx2825@gmail.com> wrote:
>
> On Fri, Oct 16, 2020 at 10:14:46AM +0100, Ian Abbott wrote:
> > On 15/10/2020 20:18, Sumera Priyadarsini wrote:
> > > The show() methods should return the number of bytes printed into the
> > > buffer which is the return value of scnprintf(). snprintf() returns the
> > > potential number of bytes that could be written which may be greater
> > > than the actual length to be written.
> > >
> > > Replace snprintf() with the safer scnprintf() in comedi_fops.c.
> > >
> > > Issue found with Coccinelle.
> > >
> > > Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> >
> > The patch is fine, but there are a couple of problems.
> >
> > 1) Patches for "staging" should be Cc'ed to devel@driverdev.osuosl.org .
>
> Hi Ian,
> Does this apply to ALL drivers under "staging" or only the comedi series
> drivers?

You can find this answer in the MAINTAINERS file :)
Check here:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS#n16640

get_maintainer.pl basically reads the content of MAINTAINERS file to inform you
who you should send the patch.

But the tutorial[1] uses "--nol" option in get_maintainer.pl script (which
removes mailing lists from the output).

[1] https://kernelnewbies.org/FirstKernelPatch#Submit_a_patch

Which I suppose is because "the maintainers of staging/vc04_services would
prefer not to be CCd on Outreachy patches", but I guess this only applies to
staging/vc04_services.

I would like to confirm that only staging/vc04_services should use --nol,
so we can improve the tutorial.

Regards,
Helen

>
> Thank you,
> Deepak.
>
> >
> > 2) It appears to be part of a patch series, but I have no clue about the
> > other patches in the series because I haven't seen them.  The patch doesn't
> > look like it depends on any other patches in a series, so it should be a
> > standalone patch, not part of a series.
> >
> > --
> > -=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
> > -=( registered in England & Wales.  Regd. number: 02862268.  )=-
> > -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
> > -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
> >
> > --
> > 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/825f5868-49f4-509d-638d-5fcab59c8f1a%40mev.co.uk.
>
> --
> 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/20201018195136.GA73063%40ubuntu204.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] Re: [Outreachy][PATCH 3/3] staging: comedi: Replace snprintf() with scnprintf()
  2020-10-18 20:35       ` Helen Koike
@ 2020-10-18 21:31         ` Julia Lawall
  0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2020-10-18 21:31 UTC (permalink / raw)
  To: Helen Koike
  Cc: Deepak R Varma, Ian Abbott, Sumera Priyadarsini,
	outreachy-kernel, Greg KH, hsweeten



On Sun, 18 Oct 2020, Helen Koike wrote:

> Hi Deepak and Ian,
>
> On Sun, Oct 18, 2020 at 4:51 PM Deepak R Varma <mh12gx2825@gmail.com> wrote:
> >
> > On Fri, Oct 16, 2020 at 10:14:46AM +0100, Ian Abbott wrote:
> > > On 15/10/2020 20:18, Sumera Priyadarsini wrote:
> > > > The show() methods should return the number of bytes printed into the
> > > > buffer which is the return value of scnprintf(). snprintf() returns the
> > > > potential number of bytes that could be written which may be greater
> > > > than the actual length to be written.
> > > >
> > > > Replace snprintf() with the safer scnprintf() in comedi_fops.c.
> > > >
> > > > Issue found with Coccinelle.
> > > >
> > > > Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> > >
> > > The patch is fine, but there are a couple of problems.
> > >
> > > 1) Patches for "staging" should be Cc'ed to devel@driverdev.osuosl.org .
> >
> > Hi Ian,
> > Does this apply to ALL drivers under "staging" or only the comedi series
> > drivers?
>
> You can find this answer in the MAINTAINERS file :)
> Check here:
>     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS#n16640
>
> get_maintainer.pl basically reads the content of MAINTAINERS file to inform you
> who you should send the patch.
>
> But the tutorial[1] uses "--nol" option in get_maintainer.pl script (which
> removes mailing lists from the output).
>
> [1] https://kernelnewbies.org/FirstKernelPatch#Submit_a_patch
>
> Which I suppose is because "the maintainers of staging/vc04_services would
> prefer not to be CCd on Outreachy patches", but I guess this only applies to
> staging/vc04_services.
>
> I would like to confirm that only staging/vc04_services should use --nol,
> so we can improve the tutorial.

In the beginning, no maintainers got CCd, but some were not happy to have
things happening to their code without their knowledge.

So as a compromise we decided that patches could go to the people listed
in the maintainers file, without spamming everyone who might be on the
mailing list.

The volume of patches seems to be down, and the quality perhaps a bit up,
so it would probably be reasonable to add the mailing lists back in.

julia


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-18  5:38     ` Greg KH
@ 2020-10-19  6:02       ` Deepak R Varma
  2020-10-19  6:09         ` Greg KH
  0 siblings, 1 reply; 20+ messages in thread
From: Deepak R Varma @ 2020-10-19  6:02 UTC (permalink / raw)
  To: Greg KH; +Cc: Matthew Wilcox, Sumera Priyadarsini, outreachy-kernel

On Sun, Oct 18, 2020 at 07:38:57AM +0200, Greg KH wrote:
> On Sun, Oct 18, 2020 at 11:02:43AM +0530, Deepak R Varma wrote:
> > On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> > > On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > > > The show() methods in device attributes should return the number of
> > > > bytes printed into the buffer which is the return value of scnprintf(). 
> > > > snprintf() returns the potential number of bytes that could be written
> > > > which may be greater than the actual length to be written.
> > > 
> > > There's a big patchset just gone into 5.10 yesterday which adds a new
> > > sysfs_emit() for show methods.  You probably want to use that instead
> > > of scnprintf().
> > > 
> > Hello Matthew,
> > I am able to build my staging branch into 5.9.0-rc8 release. Can you
> > please suggest how can I get 5.10?
> 
> Pull from Linus's tree right now, or pull from linux-next.

Thank you Greg. I assume you are fine with patches sent from that tree
base.

Deepak.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-19  6:02       ` Deepak R Varma
@ 2020-10-19  6:09         ` Greg KH
  2020-10-19  6:25           ` Deepak R Varma
  0 siblings, 1 reply; 20+ messages in thread
From: Greg KH @ 2020-10-19  6:09 UTC (permalink / raw)
  To: Deepak R Varma; +Cc: Matthew Wilcox, Sumera Priyadarsini, outreachy-kernel

On Mon, Oct 19, 2020 at 11:32:40AM +0530, Deepak R Varma wrote:
> On Sun, Oct 18, 2020 at 07:38:57AM +0200, Greg KH wrote:
> > On Sun, Oct 18, 2020 at 11:02:43AM +0530, Deepak R Varma wrote:
> > > On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> > > > On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > > > > The show() methods in device attributes should return the number of
> > > > > bytes printed into the buffer which is the return value of scnprintf(). 
> > > > > snprintf() returns the potential number of bytes that could be written
> > > > > which may be greater than the actual length to be written.
> > > > 
> > > > There's a big patchset just gone into 5.10 yesterday which adds a new
> > > > sysfs_emit() for show methods.  You probably want to use that instead
> > > > of scnprintf().
> > > > 
> > > Hello Matthew,
> > > I am able to build my staging branch into 5.9.0-rc8 release. Can you
> > > please suggest how can I get 5.10?
> > 
> > Pull from Linus's tree right now, or pull from linux-next.
> 
> Thank you Greg. I assume you are fine with patches sent from that tree
> base.

For the time up to 5.10-rc1, no, you need to work off of my
staging-testing branch as there is no way for me to merge new stuff into
linux-next until 5.10-rc1 comes out, sorry.

The middle of the merge window is a rough time to try to get new work
done, maintainers are not allowed to really take it.  I'm trying to be
nice and stage stuff for the outreachy developers, so please, work off
of staging-testing for now.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-19  6:09         ` Greg KH
@ 2020-10-19  6:25           ` Deepak R Varma
  2020-10-19  6:59             ` Greg KH
  0 siblings, 1 reply; 20+ messages in thread
From: Deepak R Varma @ 2020-10-19  6:25 UTC (permalink / raw)
  To: Greg KH; +Cc: Matthew Wilcox, Sumera Priyadarsini, outreachy-kernel

On Mon, Oct 19, 2020 at 08:09:25AM +0200, Greg KH wrote:
> On Mon, Oct 19, 2020 at 11:32:40AM +0530, Deepak R Varma wrote:
> > On Sun, Oct 18, 2020 at 07:38:57AM +0200, Greg KH wrote:
> > > On Sun, Oct 18, 2020 at 11:02:43AM +0530, Deepak R Varma wrote:
> > > > On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> > > > > On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > > > > > The show() methods in device attributes should return the number of
> > > > > > bytes printed into the buffer which is the return value of scnprintf(). 
> > > > > > snprintf() returns the potential number of bytes that could be written
> > > > > > which may be greater than the actual length to be written.
> > > > > 
> > > > > There's a big patchset just gone into 5.10 yesterday which adds a new
> > > > > sysfs_emit() for show methods.  You probably want to use that instead
> > > > > of scnprintf().
> > > > > 
> > > > Hello Matthew,
> > > > I am able to build my staging branch into 5.9.0-rc8 release. Can you
> > > > please suggest how can I get 5.10?
> > > 
> > > Pull from Linus's tree right now, or pull from linux-next.
> > 
> > Thank you Greg. I assume you are fine with patches sent from that tree
> > base.
> 
> For the time up to 5.10-rc1, no, you need to work off of my
> staging-testing branch as there is no way for me to merge new stuff into
> linux-next until 5.10-rc1 comes out, sorry.
> 
> The middle of the merge window is a rough time to try to get new work
> done, maintainers are not allowed to really take it.  I'm trying to be
> nice and stage stuff for the outreachy developers, so please, work off
> of staging-testing for now.

Thank you Greg. I understand.
In that case, the three patches I sent yesterday were from the linux-next tree. 
Will you reject those or hold back?

Deepak.

> 
> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy kernel] [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf()
  2020-10-19  6:25           ` Deepak R Varma
@ 2020-10-19  6:59             ` Greg KH
  0 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2020-10-19  6:59 UTC (permalink / raw)
  To: Deepak R Varma; +Cc: Matthew Wilcox, Sumera Priyadarsini, outreachy-kernel

On Mon, Oct 19, 2020 at 11:55:47AM +0530, Deepak R Varma wrote:
> On Mon, Oct 19, 2020 at 08:09:25AM +0200, Greg KH wrote:
> > On Mon, Oct 19, 2020 at 11:32:40AM +0530, Deepak R Varma wrote:
> > > On Sun, Oct 18, 2020 at 07:38:57AM +0200, Greg KH wrote:
> > > > On Sun, Oct 18, 2020 at 11:02:43AM +0530, Deepak R Varma wrote:
> > > > > On Thu, Oct 15, 2020 at 08:21:57PM +0100, Matthew Wilcox wrote:
> > > > > > On Fri, Oct 16, 2020 at 12:41:42AM +0530, Sumera Priyadarsini wrote:
> > > > > > > The show() methods in device attributes should return the number of
> > > > > > > bytes printed into the buffer which is the return value of scnprintf(). 
> > > > > > > snprintf() returns the potential number of bytes that could be written
> > > > > > > which may be greater than the actual length to be written.
> > > > > > 
> > > > > > There's a big patchset just gone into 5.10 yesterday which adds a new
> > > > > > sysfs_emit() for show methods.  You probably want to use that instead
> > > > > > of scnprintf().
> > > > > > 
> > > > > Hello Matthew,
> > > > > I am able to build my staging branch into 5.9.0-rc8 release. Can you
> > > > > please suggest how can I get 5.10?
> > > > 
> > > > Pull from Linus's tree right now, or pull from linux-next.
> > > 
> > > Thank you Greg. I assume you are fine with patches sent from that tree
> > > base.
> > 
> > For the time up to 5.10-rc1, no, you need to work off of my
> > staging-testing branch as there is no way for me to merge new stuff into
> > linux-next until 5.10-rc1 comes out, sorry.
> > 
> > The middle of the merge window is a rough time to try to get new work
> > done, maintainers are not allowed to really take it.  I'm trying to be
> > nice and stage stuff for the outreachy developers, so please, work off
> > of staging-testing for now.
> 
> Thank you Greg. I understand.
> In that case, the three patches I sent yesterday were from the linux-next tree. 
> Will you reject those or hold back?

I do not know, let me get around to reviewing them in the next few
days...

greg k-h


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy][PATCH 2/3] staging: fieldbus: Replace snprintf() with scnprintf()
  2020-10-15 19:16 ` [Outreachy][PATCH 2/3] staging: fieldbus: " Sumera Priyadarsini
@ 2020-10-23 13:03   ` Sven Van Asbroeck
  2020-10-23 13:39     ` Sumera Priyadarsini
  0 siblings, 1 reply; 20+ messages in thread
From: Sven Van Asbroeck @ 2020-10-23 13:03 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: outreachy-kernel, Greg KH

Hello Sumera, thank you for the patch !

Unfortunately, I think Deepak R Varma sent a patch on 18 October which
appears to solve this issue in a "better" way, by using sysfs_emit().

I would link to their patch, but I can't seem to find a server hosting the
outreachy mailing list.

On Thu, Oct 15, 2020 at 3:16 PM Sumera Priyadarsini
<sylphrenadin@gmail.com> wrote:
>
> The card_name_show() method should return the number of bytes printed into
> the buffer which is the return value of scnprintf(). snprintf() returns the
> potential number of bytes that could be written which may be greater
> than the actual length to be written.
>
> Replace snprintf() with the safer scnprintf() in dev_core.c.
>
> Issue found with Coccinelle.
>
> Signed-off-by: Sumera Priyadarsini <sylphrenadin@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..a0fcd87a1747 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 scnprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
>  }
>  static DEVICE_ATTR_RO(card_name);
>
> --
> 2.25.1
>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Outreachy][PATCH 2/3] staging: fieldbus: Replace snprintf() with scnprintf()
  2020-10-23 13:03   ` Sven Van Asbroeck
@ 2020-10-23 13:39     ` Sumera Priyadarsini
  0 siblings, 0 replies; 20+ messages in thread
From: Sumera Priyadarsini @ 2020-10-23 13:39 UTC (permalink / raw)
  To: Sven Van Asbroeck; +Cc: Outreachy, Greg KH

[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

On Fri, 23 Oct, 2020, 6:33 PM Sven Van Asbroeck, <thesven73@gmail.com>
wrote:

> Hello Sumera, thank you for the patch !
>
> Unfortunately, I think Deepak R Varma sent a patch on 18 October which
> appears to solve this issue in a "better" way, by using sysfs_emit().
>
> I would link to their patch, but I can't seem to find a server hosting the
> outreachy mailing list.
>

Hi Sven,

No worries- Deepak sent the patch before I could send a v2 but it's
alright. No need to send a link- sysfs_emit() is indeed the better way to
do it.

Warm regards,
Sumera


> On Thu, Oct 15, 2020 at 3:16 PM Sumera Priyadarsini
> <sylphrenadin@gmail.com> wrote:
> >
> > The card_name_show() method should return the number of bytes printed
> into
> > the buffer which is the return value of scnprintf(). snprintf() returns
> the
> > potential number of bytes that could be written which may be greater
> > than the actual length to be written.
> >
> > Replace snprintf() with the safer scnprintf() in dev_core.c.
> >
> > Issue found with Coccinelle.
> >
> > Signed-off-by: Sumera Priyadarsini <sylphrenadin@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..a0fcd87a1747 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 scnprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
> >  }
> >  static DEVICE_ATTR_RO(card_name);
> >
> > --
> > 2.25.1
> >
>

[-- Attachment #2: Type: text/html, Size: 2985 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-10-27  1:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 19:11 [Outreachy][PATCH 0/3] staging: Replace snprintf() with scnprintf() Sumera Priyadarsini
2020-10-15 19:14 ` [Outreachy][PATCH 1/3] staging: fbtft: " Sumera Priyadarsini
2020-10-15 19:16 ` [Outreachy][PATCH 2/3] staging: fieldbus: " Sumera Priyadarsini
2020-10-23 13:03   ` Sven Van Asbroeck
2020-10-23 13:39     ` Sumera Priyadarsini
2020-10-15 19:18 ` [Outreachy][PATCH 3/3] staging: comedi: " Sumera Priyadarsini
2020-10-16  9:14   ` Ian Abbott
2020-10-16  9:36     ` Sumera Priyadarsini
2020-10-18 19:51     ` [Outreachy kernel] " Deepak R Varma
2020-10-18 20:35       ` Helen Koike
2020-10-18 21:31         ` Julia Lawall
2020-10-15 19:21 ` [Outreachy kernel] [Outreachy][PATCH 0/3] staging: " Matthew Wilcox
2020-10-16  8:24   ` Greg KH
2020-10-16  8:44   ` Sumera Priyadarsini
2020-10-18  5:32   ` Deepak R Varma
2020-10-18  5:38     ` Greg KH
2020-10-19  6:02       ` Deepak R Varma
2020-10-19  6:09         ` Greg KH
2020-10-19  6:25           ` Deepak R Varma
2020-10-19  6:59             ` Greg KH

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.