[PATCH] uacce: use sysfs_emit instead of sprintf

yekai(A) yekai13 at huawei.com
Mon May 17 21:49:37 AEST 2021



On 2021/5/17 18:36, Greg KH wrote:
> On Mon, May 17, 2021 at 06:25:37PM +0800, Kai Ye wrote:
>> Use the sysfs_emit to replace sprintf.
>
> That says _what_ you did, not _why_ you are doing this.  What problem
> are you solving with this change?
>
> thanks,
>
> greg k-h
> .
>
sprintf is not safe, and it not recommended to use.
sprintf does not know the PAGE_SIZE maximum of the temporary buffer
used for outputting sysfs content and it's possible to overrun the
PAGE_SIZE buffer length. so used sysfs_emit that  knows that the size
of the call situations that also ensures that no overrun is done. so use 
sysfs_emit to replace sprintf maybe better.

thanks,
Kai Ye


More information about the Linux-accelerators mailing list