[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5290000-5481-c662-974f-85eea7660953@huawei.com>
Date: Mon, 17 May 2021 19:49:37 +0800
From: "yekai(A)" <yekai13@...wei.com>
To: Greg KH <gregkh@...uxfoundation.org>
CC: <linux-accelerators@...ts.ozlabs.org>,
<linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>,
<zhangfei.gao@...aro.org>, <wangzhou1@...ilicon.com>
Subject: Re: [PATCH] uacce: use sysfs_emit instead of sprintf
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
Powered by blists - more mailing lists