stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Rashika Kheria <rashika.kheria@gmail.com>
Cc: opw-kernel@googlegroups.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiang Liu <jiang.liu@huawei.com>, Nitin Gupta <ngupta@vflare.org>,
	Jerome Marchand <jmarchand@redhat.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check
Date: Wed, 30 Oct 2013 11:35:23 +0900	[thread overview]
Message-ID: <20131030023523.GC17013@bbox> (raw)
In-Reply-To: <a40fc8ee88e324a8f5ee5c79750e160b5c16288c.1383087326.git.rashika.kheria@gmail.com>

On Wed, Oct 30, 2013 at 04:45:24AM +0530, Rashika Kheria wrote:
> This patch fixes the following Smatch warning in zram_drv.c-
> drivers/staging/zram/zram_drv.c:899
> destroy_device() warn: variable dereferenced before check 'zram->disk' (see line 896)
> 
> Cc: stable@vger.kernel.org

It shouldn't be a stable stuff because it's just warning of Smatch
but there is no bug in real practice.

> Acked-by: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
>  drivers/staging/zram/zram_drv.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 592e760..bf28d56 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -901,13 +901,10 @@ static void destroy_device(struct zram *zram)
>  	sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
>  			&zram_disk_attr_group);
>  
> -	if (zram->disk) {
> -		del_gendisk(zram->disk);
> -		put_disk(zram->disk);
> -	}
> +	del_gendisk(zram->disk);
> +	put_disk(zram->disk);
>  
> -	if (zram->queue)
> -		blk_cleanup_queue(zram->queue);
> +	blk_cleanup_queue(zram->queue);
>  }
>  
>  static int __init zram_init(void)
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Kind regards,
Minchan Kim

  reply	other threads:[~2013-10-30  2:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20131019110539.GA25167@gmail.com>
2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
2013-10-29 23:12   ` [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-10-30  2:33     ` Minchan Kim
2013-10-29 23:15   ` [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
2013-10-30  2:35     ` Minchan Kim [this message]
2013-10-30 10:44     ` Jerome Marchand
2013-10-30  2:24   ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Minchan Kim
2013-10-30  2:36   ` Minchan Kim
2013-10-30 10:42   ` Jerome Marchand
2013-10-30 13:06 ` [PATCH v8 " Rashika Kheria
2013-10-30 13:10   ` [PATCH v8 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-10-31  9:42     ` Weijie Yang
2013-10-31 11:56 ` [PATCH v9 1/2] Staging: zram: Fix access of NULL pointer Rashika Kheria
2013-10-31 11:58   ` [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-11-01  2:00     ` Minchan Kim
2013-11-01  8:54     ` Jerome Marchand
2013-11-01 14:13       ` Rashika Kheria
2013-11-01 14:06 ` [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch Rashika Kheria
2013-11-10 15:45   ` Greg Kroah-Hartman
2013-11-10 15:56     ` [OPW kernel] " Rashika Kheria
2013-11-10 16:10       ` Greg Kroah-Hartman
2013-11-10 16:14         ` Rashika Kheria

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=20131030023523.GC17013@bbox \
    --to=minchan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiang.liu@huawei.com \
    --cc=jmarchand@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=opw-kernel@googlegroups.com \
    --cc=rashika.kheria@gmail.com \
    --cc=stable@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).