[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180814164523.e0fdeed962917e23062ef958@linux-foundation.org>
Date: Tue, 14 Aug 2018 16:45:23 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Minchan Kim <minchan@...nel.org>,
Peter Kalauskas <peskal@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] zram: fix bug storing backing_dev
On Mon, 13 Aug 2018 16:38:25 +0900 Sergey Senozhatsky <sergey.senozhatsky.work@...il.com> wrote:
> On (08/13/18 15:16), Minchan Kim wrote:
> > > The call to strlcpy in backing_dev_store is incorrect. It should take
> > > the size of the destination buffer instead of the size of the source
> > > buffer. Additionally, ignore the newline character (\n) when reading
> > > the new file_name buffer. This makes it possible to set the backing_dev
> > > as follows:
> > >
> > > echo /dev/sdX > /sys/block/zram0/backing_dev
> > >
> > > Signed-off-by: Peter Kalauskas <peskal@...gle.com>
> > Acked-by: Minchan Kim <minchan@...nel.org>
> >
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
> > CC: LKML <linux-kernel@...r.kernel.org>
> > Cc: <stable@...r.kernel.org> [4.14+]
>
> Thanks for Cc-ing Minchan.
>
> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
>
> > > - strlcpy(file_name, buf, len);
>
> This is quite interesting. The reason it worked before was the fact that
> strlcpy() copies 'len - 1' bytes, which is strlen(buf) - 1 in our case,
> so it accidentally didn't copy the trailing new line symbol. Which also
> means that "echo -n /dev/sdX" most likely was broken.
>
I can't find the original email on lkml for some reason, but I
recreated the patch.
The changelog doesn't describe the end-user impact of the bug, which is
very desirable when tagging a patch for -stable backporting. Can we
have that paragraph please?
The implementation might be able to use strim() somehow.
Powered by blists - more mailing lists