lkml.org 
[lkml]   [2005]   [May]   [17]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 17 May 2005 08:38:27 +0100
FromAl Viro <>
SubjectRe: [PATCH] Fix root hole in raw device
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 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/

\
 
 \ /
  Last update: 2005-05-17 09:52    [from the cache]
©2003-2008