From: Takashi Iwai <tiwai@suse.de>
To: Coly Li <colyli@suse.de>
Cc: Kent Overstreet <kent.overstreet@gmail.com>,
linux-bcache@vger.kernel.org
Subject: Re: [PATCH] bcache: Use scnprintf() for avoiding potential buffer overflow
Date: Thu, 19 Mar 2020 17:28:36 +0100 [thread overview]
Message-ID: <s5hsgi4tikr.wl-tiwai@suse.de> (raw)
In-Reply-To: <d5be999d-ac69-8b22-667a-8815d3f9934d@suse.de>
On Thu, 19 Mar 2020 17:27:47 +0100,
Coly Li wrote:
>
> On 2020/3/19 11:58 下午, Takashi Iwai wrote:
> > On Wed, 11 Mar 2020 08:45:58 +0100,
> > Takashi Iwai wrote:
> >>
> >> Since snprintf() returns the would-be-output size instead of the
> >> actual output size, the succeeding calls may go beyond the given
> >> buffer limit. Fix it by replacing with scnprintf().
> >>
> >> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> >
> > A gentle reminder for this forgotten patch.
> > Let me know if any further changes are needed.
> >
>
> Hi Takashi,
>
> This is in my for-next list already. Sorry for not reply you yet, just
> busy on the testing with combined with md raid backend.
OK, thanks. I just wondered because it didn't appear on linux-next,
either.
Takashi
>
> Thanks.
>
> Coly Li
>
> >> ---
> >> drivers/md/bcache/sysfs.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> >> index 3470fae4eabc..323276994aab 100644
> >> --- a/drivers/md/bcache/sysfs.c
> >> +++ b/drivers/md/bcache/sysfs.c
> >> @@ -154,7 +154,7 @@ static ssize_t bch_snprint_string_list(char *buf,
> >> size_t i;
> >>
> >> for (i = 0; list[i]; i++)
> >> - out += snprintf(out, buf + size - out,
> >> + out += scnprintf(out, buf + size - out,
> >> i == selected ? "[%s] " : "%s ", list[i]);
> >>
> >> out[-1] = '\n';
> >> --
> >> 2.16.4
> >>
>
>
> --
>
> Coly Li
>
next prev parent reply other threads:[~2020-03-19 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 7:45 [PATCH] bcache: Use scnprintf() for avoiding potential buffer overflow Takashi Iwai
2020-03-19 15:58 ` Takashi Iwai
2020-03-19 16:27 ` Coly Li
2020-03-19 16:28 ` Takashi Iwai [this message]
2020-03-19 16:32 ` Coly Li
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=s5hsgi4tikr.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=colyli@suse.de \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcache@vger.kernel.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