Re: [PATCH] Fix root hole in raw device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 17, 2005 at 09:07:35AM +0200, Willy Tarreau wrote:
> >  	struct block_device *bdev = filp->private_data;
> >  	int err = -EINVAL;
> >  
> > -	return ioctl_by_bdev(bdev, command, arg);
> > +	if (bdev && bdev->bd_inode)
> > +		err = blkdev_ioctl(bdev->bd_inode, filp, command, arg);
>                                                  ^^^^^^^
> Sorry, I forgot it...
> I meant the same with the NULL. Is it OK ?

What is that if () doing there?  bdev->bd_inode is *never* NULL - it's
set when we allocate the bdev and never changed; the code setting it
is
        if (inode->i_state & I_NEW) {
                bdev->bd_contains = NULL;
                bdev->bd_inode = inode;
so you are not going to have it NULL, no matter what.

And filp->private_data is set in raw_open() by
        filp->private_data = bdev;
a couple of lines after
        filp->f_mapping = bdev->bd_inode->i_mapping;
so it's not going to be NULL either.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux