[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190320015507.GC4718@jagdpanzerIV>
Date: Wed, 20 Mar 2019 10:55:07 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Minchan Kim <minchan@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
LKML <linux-kernel@...r.kernel.org>, stable@...r.kernel.org,
Makoto Wu <makotowu@...gle.com>
Subject: Re: [PATCH] zram: fix idle/writeback string compare
On (03/20/19 08:19), Minchan Kim wrote:
> Cc: <stable@...r.kernel.org> [5.0]
> Reported-by: Makoto Wu <makotowu@...gle.com>
> Signed-off-by: Minchan Kim <minchan@...nel.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
> +++ b/drivers/block/zram/zram_drv.c
> @@ -290,18 +290,8 @@ static ssize_t idle_store(struct device *dev,
> struct zram *zram = dev_to_zram(dev);
> unsigned long nr_pages = zram->disksize >> PAGE_SHIFT;
> int index;
> - char mode_buf[8];
> - ssize_t sz;
>
> - sz = strscpy(mode_buf, buf, sizeof(mode_buf));
> - if (sz <= 0)
> - return -EINVAL;
> -
> - /* ignore trailing new line */
> - if (mode_buf[sz - 1] == '\n')
> - mode_buf[sz - 1] = 0x00;
> -
> - if (strcmp(mode_buf, "all"))
> + if (!sysfs_streq(buf, "all"))
> return -EINVAL;
[..]
That's a good improvement of the code.
-ss
Powered by blists - more mailing lists