Messages in this thread | | | Subject | Re: [PATCH] s390: replace snprintf in show functions with sysfs_emit | From | Joe Perches <> | Date | Mon, 18 Oct 2021 07:20:39 -0700 |
| |
On Mon, 2021-10-18 at 13:50 +0200, Vineeth Vijayan wrote: > Acked-by: Vineeth Vijayan <vneethv@linux.ibm.com> [] > On Thu, 2021-10-14 at 23:50 -0700, Qing Wang wrote: > > show() must not use snprintf() when formatting the value to be > > returned to user space. [] > > diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c [] > > @@ -731,7 +731,7 @@ static ssize_t dasd_ff_show(struct device *dev, [] > > - return snprintf(buf, PAGE_SIZE, ff_flag ? "1\n" : "0\n"); > > + return sysfs_emit(buf, ff_flag ? "1\n" : "0\n");
It's more common to use
return sysfs_emit(buf, "%d\n", ff_flag);
> > @@ -773,7 +773,7 @@ dasd_ro_show(struct device *dev, struct [] > > - return snprintf(buf, PAGE_SIZE, ro_flag ? "1\n" : "0\n"); > > + return sysfs_emit(buf, ro_flag ? "1\n" : "0\n");
etc...
| |