Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 14 Oct 2002 15:26:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 14 Oct 2002 15:26:15 -0400 Received: from leibniz.math.psu.edu ([146.186.130.2]:65522 "EHLO math.psu.edu") by vger.kernel.org with ESMTP id ; Mon, 14 Oct 2002 15:26:13 -0400 Date: Mon, 14 Oct 2002 15:32:00 -0400 (EDT) From: Alexander Viro To: Christoph Hellwig cc: Joe Thornber , Linus Torvalds , Kernel Mailing List , Alan Cox , Jens Axboe Subject: Re: Linux v2.5.42 In-Reply-To: <20021014202158.A27076@infradead.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1452 Lines: 55 On Mon, 14 Oct 2002, Christoph Hellwig wrote: > +{ > + int r; > + > + if (d->bdev) > + BUG(); > + > + if (!(d->bdev = bdget(kdev_t_to_nr(d->dev)))) > + return -ENOMEM; > + > + r = blkdev_get(d->bdev, d->mode, 0, BDEV_RAW); > + if (r) { > + bdput(d->bdev); *blam* failing blkdev_get() does bdput() itself. > + > + if (sscanf(path, "%x:%x", &major, &minor) == 2) { > + /* Extract the major/minor numbers */ > + dev = mk_kdev(major, minor); > + } else { > + /* convert the path to a device */ > + if ((r = lookup_device(path, &dev))) > + return r; > + } > > What do you need the major/minor version for? ... and in any case, both branches should result in struct block_device * (the former - via bdget(MKDEV(...));) > + switch (command) { > + case BLKGETSIZE: > + l_size = (long) size; > + if (copy_to_user((void *) a, &l_size, sizeof(long))) > + return -EFAULT; > + break; > These two are in generic code and odn't need to be implemented > by a lowlevel driver (won't ever be called). Not only that, but BLKGETSIZE above is missing overflow check. (these two are still called, with generic version called if we get -EINVAL; with patches submitted to Linus they won't be even tried). - 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/