staging: comedi: Use sysfs_emit for show(device *...) functions
PATCH 1/1 staging: comedi: Use sysfs_emit for show(device *...) functions
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
--- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/comedi/comedi_fops.c +4 -4
@@ -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,
Signature · 1 line
2.25.1
Quoted 53 lines · Deepak R Varma,
Convert snprintf calls in device show functions to
sysfs_emitforPAGE_SIZEbuffer safety.
Warning generated by:scripts/coccinelle/api/device_attr_show.cocciSigned-off-by Deepak R Varma <[email protected]>--- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_read_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tread_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_write_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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); }
Quoted 4 lines
static
ssize_twrite_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
Quoted 8 lines
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20201018180954.GA39024%40ubuntu204
.
Quoted 62 lines · Sumera Priyadarsini
Quoted 53 lines · Deepak R Varma,
Convert snprintf calls in device show functions to
sysfs_emitforPAGE_SIZEbuffer safety.
Warning generated by:scripts/coccinelle/api/device_attr_show.cocciSigned-off-by Deepak R Varma <[email protected]>--- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_read_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tread_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_write_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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); }Quoted 4 lines
static
ssize_twrite_buffer_kb_store(struct device *csdev,
--
2.25.1Hi Deepak,
Quoted 8 lines
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.
Quoted 9 lines
Quoted 8 lines
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20201018180954.GA39024%40ubuntu204
.
Hi Deepak,
Quoted 69 lines · Deepak R Varma
Quoted 67 lines · Sumera Priyadarsini
Quoted 53 lines · Deepak R Varma,
Convert snprintf calls in device show functions to
sysfs_emitforPAGE_SIZEbuffer safety.
Warning generated by:scripts/coccinelle/api/device_attr_show.cocciSigned-off-by Deepak R Varma <[email protected]>--- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_read_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tread_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_write_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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); }Quoted 4 lines
static
ssize_twrite_buffer_kb_store(struct device *csdev,
--
2.25.1Hi 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. :-)
Quoted 7 lines
Quoted 3 lines
Thanks, and regards,
SumeraSure. 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.
Nice work you are doing with the contribution period :)
I just want to second what Sumera said.
Since Sumera had already replied in the past email thread[1] (which you also replied, so I guess you saw her reply there), she mentioned she would submit V2 with those changes.
[1] https://groups.google.com/g/outreachy-kernel/c/-VkRW5siDic/m/vGVf6Ft0AwAJ
In a community workflow, when a person sends a patch and people request changes, we usually wait for the original author to submit v2, even if you know how to fix it quickly.
And if, for some reason, you need that change now (which wasn't the case), it is a good practice to ask the author if you can send v2 on their behalf.
You can expect the same from others too. I hope this helps a bit, clarifying how the community works :)
Keep the nice work!
Regards,
Helen
Quoted 18 lines
Thanks.
Deepak.Quoted 9 lines
--
Quoted 8 lines
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20201018180954.GA39024%40ubuntu204
.--
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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20201018184550.GA53720%40ubuntu204.
Quoted 95 lines · Helen Koike
Hi Deepak,
Quoted 69 lines · Deepak R Varma
Quoted 67 lines · Sumera Priyadarsini
Quoted 53 lines · Deepak R Varma,
Convert snprintf calls in device show functions to
sysfs_emitforPAGE_SIZEbuffer safety.
Warning generated by:scripts/coccinelle/api/device_attr_show.cocciSigned-off-by Deepak R Varma <[email protected]>--- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_read_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tread_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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_tmax_write_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +1
-1@@ -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); }Quoted 4 lines
static
ssize_twrite_buffer_kb_store(struct device *csdev,
--
2.25.1Hi 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. :-)
Quoted 7 lines
Quoted 3 lines
Thanks, and regards,
SumeraSure. 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.Nice work you are doing with the contribution period :)
I just want to second what Sumera said.
Since Sumera had already replied in the past email thread[1] (which you also replied, so I guess you saw her reply there), she mentioned she would submit V2 with those changes.[1] https://groups.google.com/g/outreachy-kernel/c/-VkRW5siDic/m/vGVf6Ft0AwAJ
In a community workflow, when a person sends a patch and people request changes, we usually wait for the original author to submit v2, even if you know how to fix it quickly.
And if, for some reason, you need that change now (which wasn't the case), it is a good practice to ask the author if you can send v2 on their behalf.
Quoted 8 lines
You can expect the same from others too. I hope this helps a bit, clarifying how the community works :)
Keep the nice work!
Regards,
Helen
Hi Helen,
That makes perfect sense. It was my bad. I should not have modified these files. I will remember your advise going forward.
Hi Sumera,
Once again, sorry for the overstepping. I will keep the protocol in mind going forward.
For now, I am happy if you would like to get these patches on your name since you started with these. Absolutely fine with me.
Thank you,
Deepak.
Quoted 18 lines
Quoted 18 lines
Thanks.
Deepak.Quoted 9 lines
--
Quoted 8 lines
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20201018180954.GA39024%40ubuntu204
.--
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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20201018184550.GA53720%40ubuntu204.
Quoted 124 lines · Deepak R Varma,
Quoted 3 lines · Helen Koike
Hi Deepak,
On Sun, Oct 18, 2020 at 3:45 PM Deepak R Varma <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines · Sumera Priyadarsini
Quoted 1 line
On Sun, 18 Oct, 2020, 11:40 PM Deepak R Varma, <[email protected]>
Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Convert snprintf calls in device show functions to
sysfs_emitforPAGE_SIZEbuffer safety.
Warning generated by:scripts/coccinelle/api/device_attr_show.cocciSigned-off-by Deepak R Varma <[email protected]>--- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/staging/comedi/comedi_fops.c static ssize_t max_read_buffer_kb_show(struct
Quoted 6 lines
drivers/staging/comedi/comedi_fops.c +0
-0@@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(structdevice
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/staging/comedi/comedi_fops.c static ssize_t read_buffer_kb_show(struct
Quoted 10 lines
drivers/staging/comedi/comedi_fops.c +1
-1*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_tmax_read_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +0
-0@@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(structdevice
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/staging/comedi/comedi_fops.c static ssize_t max_write_buffer_kb_show(struct
Quoted 10 lines
drivers/staging/comedi/comedi_fops.c +1
-1*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_tread_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +0
-0@@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(structdevice
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/staging/comedi/comedi_fops.c static ssize_t write_buffer_kb_show(struct
Quoted 10 lines
drivers/staging/comedi/comedi_fops.c +1
-1*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_tmax_write_buffer_kb_store(struct device *csdev,drivers/staging/comedi/comedi_fops.c +0
-0@@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(structdevice
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
drivers/staging/comedi/comedi_fops.c +1
-1*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_twrite_buffer_kb_store(struct device *csdev,
--
2.25.1Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
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
Quoted 1 line
Quoted 1 line
Quoted 1 line
remove this file from my V2. But please give me a heads-up the next
time so
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
we are not working on the same files. :-)
Thanks, and regards,
SumeraQuoted 8 lines
Quoted 3 lines
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.Nice work you are doing with the contribution period :)
I just want to second what Sumera said.
Since Sumera had already replied in the past email thread[1] (which youalso
Quoted 1 line
replied, so I guess you saw her reply there), she mentioned she would
submit
Quoted 3 lines
V2 with those changes.
[1]
https://groups.google.com/g/outreachy-kernel/c/-VkRW5siDic/m/vGVf6Ft0AwAJ
Quoted 3 lines
In a community workflow, when a person sends a patch and people request changes, we usually wait for the original author to submit v2, even if
you
Quoted 2 lines
know how to fix it quickly.
And if, for some reason, you need that change now (which wasn't thecase),
Quoted 1 line
it is a good practice to ask the author if you can send v2 on their
behalf.
Quoted 2 lines
You can expect the same from others too. I hope this helps a bit,
clarifying how
Quoted 7 lines
the community works :)
Keep the nice work!
Regards,
HelenHi Helen,
That makes perfect sense. It was my bad. I should not have modified these files. I will remember your advise going forward.
Quoted 6 lines
Hi Sumera,
Once again, sorry for the overstepping. I will keep the protocol in mind going forward.
For now, I am happy if you would like to get these patches on your name since you started with these. Absolutely fine with me.
Hey Deepak,
Like I said, I am okay with it. :-)
Thanks,
Sumera
Thank you,
Quoted 28 lines
Deepak.
Quoted 6 lines
Quoted 6 lines
Thanks.
Deepak.Quoted 2 lines
--
Quoted 1 line
You received this message because you are subscribed to the Google
Groups
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it,send an
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20201018180954.GA39024%40ubuntu204
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
.
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 1 line
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20201018184550.GA53720%40ubuntu204
.