* [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf
@ 2022-03-02 12:07 Nguyen Dinh Phi
2022-03-02 14:51 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Nguyen Dinh Phi @ 2022-03-02 12:07 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Nguyen Dinh Phi
Convert sprintf() to sysfs_emit() in order to check buffer overrun on sysfs
outputs.
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
---
samples/kobject/kobject-example.c | 4 ++--
samples/kobject/kset-example.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/samples/kobject/kobject-example.c b/samples/kobject/kobject-example.c
index 9e383fdbaa00..96678ed73216 100644
--- a/samples/kobject/kobject-example.c
+++ b/samples/kobject/kobject-example.c
@@ -28,7 +28,7 @@ static int bar;
static ssize_t foo_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{
- return sprintf(buf, "%d\n", foo);
+ return sysfs_emit(buf, "%d\n", foo);
}
static ssize_t foo_store(struct kobject *kobj, struct kobj_attribute *attr,
@@ -60,7 +60,7 @@ static ssize_t b_show(struct kobject *kobj, struct kobj_attribute *attr,
var = baz;
else
var = bar;
- return sprintf(buf, "%d\n", var);
+ return sysfs_emit(buf, "%d\n", var);
}
static ssize_t b_store(struct kobject *kobj, struct kobj_attribute *attr,
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index c8010f126808..52f1acabd479 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -112,7 +112,7 @@ static void foo_release(struct kobject *kobj)
static ssize_t foo_show(struct foo_obj *foo_obj, struct foo_attribute *attr,
char *buf)
{
- return sprintf(buf, "%d\n", foo_obj->foo);
+ return sysfs_emit(buf, "%d\n", foo_obj->foo);
}
static ssize_t foo_store(struct foo_obj *foo_obj, struct foo_attribute *attr,
@@ -144,7 +144,7 @@ static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr,
var = foo_obj->baz;
else
var = foo_obj->bar;
- return sprintf(buf, "%d\n", var);
+ return sysfs_emit(buf, "%d\n", var);
}
static ssize_t b_store(struct foo_obj *foo_obj, struct foo_attribute *attr,
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf
2022-03-02 12:07 [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf Nguyen Dinh Phi
@ 2022-03-02 14:51 ` Greg KH
2022-03-02 18:11 ` Phi Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-03-02 14:51 UTC (permalink / raw)
To: Nguyen Dinh Phi; +Cc: linux-kernel
On Wed, Mar 02, 2022 at 08:07:59PM +0800, Nguyen Dinh Phi wrote:
> Convert sprintf() to sysfs_emit() in order to check buffer overrun on sysfs
> outputs.
There are no such buffer overruns on these sysfs files.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> ---
> samples/kobject/kobject-example.c | 4 ++--
> samples/kobject/kset-example.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
Why is this a resend? What happened to the first version?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf
2022-03-02 14:51 ` Greg KH
@ 2022-03-02 18:11 ` Phi Nguyen
2022-03-02 20:22 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Phi Nguyen @ 2022-03-02 18:11 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
On 3/2/2022 10:51 PM, Greg KH wrote:
> On Wed, Mar 02, 2022 at 08:07:59PM +0800, Nguyen Dinh Phi wrote:
>> Convert sprintf() to sysfs_emit() in order to check buffer overrun on sysfs
>> outputs.
>
> There are no such buffer overruns on these sysfs files.
>
I don't want to duplicate the title so I use the description of
sysfs_emit() as the patch message. I have just realized that the title
is also incorrect, sorry for my mistake.
>>
>> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
>> ---
>> samples/kobject/kobject-example.c | 4 ++--
>> samples/kobject/kset-example.c | 4 ++--
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> Why is this a resend? What happened to the first version?
>
> thanks,
>
> greg k-h
There is no response for the first version. Actually, there is no
Maintainer is associated with these two files (in MAINTAINERS files),
hence, my first patch was only sent to the linux-kernel mailing list.
BR,
Phi.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf
2022-03-02 18:11 ` Phi Nguyen
@ 2022-03-02 20:22 ` Greg KH
2022-03-03 8:45 ` Phi Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-03-02 20:22 UTC (permalink / raw)
To: Phi Nguyen; +Cc: linux-kernel
On Thu, Mar 03, 2022 at 02:11:36AM +0800, Phi Nguyen wrote:
> On 3/2/2022 10:51 PM, Greg KH wrote:
> > On Wed, Mar 02, 2022 at 08:07:59PM +0800, Nguyen Dinh Phi wrote:
> > > Convert sprintf() to sysfs_emit() in order to check buffer overrun on sysfs
> > > outputs.
> >
> > There are no such buffer overruns on these sysfs files.
> >
> I don't want to duplicate the title so I use the description of sysfs_emit()
> as the patch message. I have just realized that the title is also incorrect,
> sorry for my mistake.
>
> > >
> > > Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> > > ---
> > > samples/kobject/kobject-example.c | 4 ++--
> > > samples/kobject/kset-example.c | 4 ++--
> > > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > Why is this a resend? What happened to the first version?
> >
> > thanks,
> >
> > greg k-h
>
> There is no response for the first version. Actually, there is no Maintainer
> is associated with these two files (in MAINTAINERS files), hence, my first
> patch was only sent to the linux-kernel mailing list.
You need to give reviewers a hint as to what is going on when you do
this, we can't read minds :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf
2022-03-02 20:22 ` Greg KH
@ 2022-03-03 8:45 ` Phi Nguyen
2022-03-03 13:09 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Phi Nguyen @ 2022-03-03 8:45 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
On 3/3/2022 4:22 AM, Greg KH wrote:
> On Thu, Mar 03, 2022 at 02:11:36AM +0800, Phi Nguyen wrote:
>> On 3/2/2022 10:51 PM, Greg KH wrote:
>>> On Wed, Mar 02, 2022 at 08:07:59PM +0800, Nguyen Dinh Phi wrote:
>>>> Convert sprintf() to sysfs_emit() in order to check buffer overrun on sysfs
>>>> outputs.
>>>
>>> There are no such buffer overruns on these sysfs files.
>>>
>> I don't want to duplicate the title so I use the description of sysfs_emit()
>> as the patch message. I have just realized that the title is also incorrect,
>> sorry for my mistake.
>>
>>>>
>>>> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
>>>> ---
>>>> samples/kobject/kobject-example.c | 4 ++--
>>>> samples/kobject/kset-example.c | 4 ++--
>>>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> Why is this a resend? What happened to the first version?
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>> There is no response for the first version. Actually, there is no Maintainer
>> is associated with these two files (in MAINTAINERS files), hence, my first
>> patch was only sent to the linux-kernel mailing list.
>
> You need to give reviewers a hint as to what is going on when you do
> this, we can't read minds :)
>
> thanks,
>
> greg k-h
Hi Greg,
Am I right in thinking that you are the maintainer of these files? Can I
send a patch to add an entry to /linux/MAINTAINERS file?
BR,
Phi.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf
2022-03-03 8:45 ` Phi Nguyen
@ 2022-03-03 13:09 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2022-03-03 13:09 UTC (permalink / raw)
To: Phi Nguyen; +Cc: linux-kernel
On Thu, Mar 03, 2022 at 04:45:07PM +0800, Phi Nguyen wrote:
> On 3/3/2022 4:22 AM, Greg KH wrote:
> Am I right in thinking that you are the maintainer of these files?
Yes, I think so.
> Can I send a patch to add an entry to /linux/MAINTAINERS file?
Please do.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-03 13:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 12:07 [PATCH RESEND] samples/kobject: Use sysfs_emit instead of snprintf Nguyen Dinh Phi
2022-03-02 14:51 ` Greg KH
2022-03-02 18:11 ` Phi Nguyen
2022-03-02 20:22 ` Greg KH
2022-03-03 8:45 ` Phi Nguyen
2022-03-03 13:09 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).