On Sat, Oct 19, 2013 at 01:59:05PM -0700, Greg KH wrote:
> On Sat, Oct 19, 2013 at 10:01:42PM +0530, Rashika Kheria wrote:
> > This patch fixes the following Smatch warning in zram_drv.c-
> > ~/git/kernels/linux/drivers/staging/zram/zram_drv.c:663
> > reset_store() warn: variable dereferenced before check 'bdev' (see line 652)
> > ~/git/kernels/linux/drivers/staging/zram/zram_drv.c:899
> > destroy_device() warn: variable dereferenced before check 'zram->disk' (see 
> > line 896)
> > 
> > Signed-off-by: Rashika Kheria <rashika.khe...@gmail.com>
> 
> zram is messy, tricky, and I hate it.  Seriously, I which I had never
> taken it into the staging tree...
> 
> Anyway, I want the existing zram developers/maintainers to review this
> patch before I can accept it, as I don't trust anything that is ever
> done in that code, especially as I don't test it :)
> 
> Minchan, Jiang, Nitin, what do you think of the patch below?  Can I get
> your ack on it so that I can apply it?

Hello Greg,

I will review he send v3 again if anybody doesn't review it.
Hope that Jerome or someone could review because I'm in LinuxCon now and
totally fail to adjust time zone.
So, Please understand late reply.

Thanks.

> 
> thanks,
> 
> greg k-h
> 
> > ---
> > 
> > This revision fixes the following issues of the previous revision-
> > Incorrect Correction of Sparse Warning
> > 
> >  drivers/staging/zram/zram_drv.c |    8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/zram/zram_drv.c 
> > b/drivers/staging/zram/zram_drv.c
> > index 2c4ed52..a74108a 100644
> > --- a/drivers/staging/zram/zram_drv.c
> > +++ b/drivers/staging/zram/zram_drv.c
> > @@ -660,8 +660,7 @@ static ssize_t reset_store(struct device *dev,
> >             return -EINVAL;
> >  
> >     /* Make sure all pending I/O is finished */
> > -   if (bdev)
> > -           fsync_bdev(bdev);
> > +   fsync_bdev(bdev);
> >  
> >     zram_reset_device(zram, true);
> >     return len;
> > @@ -893,10 +892,9 @@ out:
> >  
> >  static void destroy_device(struct zram *zram)
> >  {
> > -   sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
> > -                   &zram_disk_attr_group);
> > -
> >     if (zram->disk) {
> > +           sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
> > +                           &zram_disk_attr_group);
> >             del_gendisk(zram->disk);
> >             put_disk(zram->disk);
> >     }
> > -- 
> > 1.7.9.5
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "opw-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to opw-kernel+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.

-- 
Kind regards,
Minchan Kim
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to