mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "yekai(A)" <yekai13@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
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 19:49:37 +0800	[thread overview]
Message-ID: <e5290000-5481-c662-974f-85eea7660953@huawei.com> (raw)
In-Reply-To: <YKJHGP9LTnCRfIx6@kroah.com>



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

  reply	other threads:[~2021-05-17 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 10:25 Kai Ye
2021-05-17 10:36 ` Greg KH
2021-05-17 11:49   ` yekai(A) [this message]
2021-05-17 11:56     ` Greg KH

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=e5290000-5481-c662-974f-85eea7660953@huawei.com \
    --to=yekai13@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-accelerators@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=wangzhou1@hisilicon.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

all inboxes | Powered by JetHome®