linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org, Makoto Wu <makotowu@google.com>
Subject: Re: [PATCH] zram: fix idle/writeback string compare
Date: Wed, 20 Mar 2019 10:55:07 +0900	[thread overview]
Message-ID: <20190320015507.GC4718@jagdpanzerIV> (raw)
In-Reply-To: <20190319231911.145968-1-minchan@kernel.org>

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

      reply	other threads:[~2019-03-20  1:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 23:19 Minchan Kim
2019-03-20  1:55 ` Sergey Senozhatsky [this message]

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=20190320015507.GC4718@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=makotowu@google.com \
    --cc=minchan@kernel.org \
    --cc=stable@vger.kernel.org \
    --subject='Re: [PATCH] zram: fix idle/writeback string compare' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).