On (03/20/19 08:19), Minchan Kim wrote:
Cc: stable@vger.kernel.org [5.0] Reported-by: Makoto Wu makotowu@google.com Signed-off-by: Minchan Kim minchan@kernel.org
Reviewed-by: Sergey Senozhatsky sergey.senozhatsky@gmail.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