On (03/20/19 08:19), Minchan Kim wrote:
> Cc: <[email protected]>  [5.0]
> Reported-by: Makoto Wu <[email protected]>
> Signed-off-by: Minchan Kim <[email protected]>

Reviewed-by: Sergey Senozhatsky <[email protected]>

> +++ 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

Reply via email to