samples/kobject: Use sysfs_emit instead of snprintf
PATCH RESEND 1/1 samples/kobject: Use sysfs_emit instead of snprintf
Convert sprintf() to sysfs_emit() in order to check buffer overrun on sysfs outputs.
--- samples/kobject/kobject-example.c | 4 ++-- samples/kobject/kset-example.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
samples/kobject/kobject-example.c +2 -2
@@ -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,
samples/kobject/kset-example.c +2 -2
@@ -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,
Signature · 1 line
2.25.1
Quoted 2 lines · Nguyen Dinh Phi
Convert
sprintf()tosysfs_emit()in order to check buffer overrun on sysfs outputs.
There are no such buffer overruns on these sysfs files.
Quoted 6 lines
Signed-off-by Nguyen Dinh Phi <[email protected]>--- 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
Quoted 6 lines · Greg KH
Quoted 2 lines · Nguyen Dinh Phi
Convert
sprintf()tosysfs_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.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Nguyen Dinh Phi <[email protected]>--- samples/kobject/kobject-example.c | 4 ++-- samples/kobject/kset-example.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
Quoted 5 lines
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.
Quoted 20 lines · Phi Nguyen
Quoted 6 lines · Greg KH
Quoted 2 lines · Nguyen Dinh Phi
Convert
sprintf()tosysfs_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.Quoted 9 lines
Quoted 6 lines
Signed-off-by Nguyen Dinh Phi <[email protected]>--- 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?
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
There is no response for the first version. Actually, there is no Maintainer is associated with these two files (in
MAINTAINERSfiles), 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
Quoted 29 lines · Greg KH
Quoted 20 lines · Phi Nguyen
Quoted 6 lines · Greg KH
Quoted 2 lines · Nguyen Dinh Phi
Convert
sprintf()tosysfs_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.Quoted 9 lines
Quoted 6 lines
Signed-off-by Nguyen Dinh Phi <[email protected]>--- 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?
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
There is no response for the first version. Actually, there is no Maintainer is associated with these two files (in
MAINTAINERSfiles), hence, my first patch was only sent to the linux-kernel mailing list.
Quoted 6 lines
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.
Quoted 2 lines · Phi Nguyen
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.
Quoted 1 line
Can I send a patch to add an entry to /linux/MAINTAINERS file?
Please do.
thanks,
greg k-h