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/
This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:51 EST