From: Greg KH <gregkh@linuxfoundation.org>
To: "yekai(A)" <yekai13@huawei.com>
Cc: linux-accelerators@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linuxarm@huawei.com,
zhangfei.gao@linaro.org, wangzhou1@hisilicon.com
Subject: Re: [PATCH] uacce: use sysfs_emit instead of sprintf
Date: Mon, 17 May 2021 13:56:35 +0200 [thread overview]
Message-ID: <YKJZ8278k0GEcF87@kroah.com> (raw)
In-Reply-To: <e5290000-5481-c662-974f-85eea7660953@huawei.com>
On Mon, May 17, 2021 at 07:49:37PM +0800, yekai(A) wrote:
>
>
> 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.
Why not? What is "unsafe" with it in this function?
> 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.
But that's not a problem at all for these calls, right? If so, please
show me how that could ever happen.
thanks,
greg k-h
prev parent reply other threads:[~2021-05-17 11:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 10:25 [PATCH] uacce: use sysfs_emit instead of sprintf Kai Ye
2021-05-17 10:36 ` Greg KH
2021-05-17 11:49 ` yekai(A)
2021-05-17 11:56 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKJZ8278k0GEcF87@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-accelerators@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=wangzhou1@hisilicon.com \
--cc=yekai13@huawei.com \
--cc=zhangfei.gao@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).