Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359548
b: refs/heads/master
c: b1a6650
h: refs/heads/master
v: v3
  • Loading branch information
Guo Chao authored and Jens Axboe committed Feb 22, 2013
1 parent 2d9340c commit 3e19420
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b0576a3d835b4d46ed85d817ce016e90bf293a3
refs/heads/master: b1a6650406875b9097a032eed89af50682fe1160
22 changes: 16 additions & 6 deletions trunk/drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,11 +1844,15 @@ static int __init loop_init(void)
max_part = (1UL << part_shift) - 1;
}

if ((1UL << part_shift) > DISK_MAX_PARTS)
return -EINVAL;
if ((1UL << part_shift) > DISK_MAX_PARTS) {
err = -EINVAL;
goto misc_out;
}

if (max_loop > 1UL << (MINORBITS - part_shift))
return -EINVAL;
if (max_loop > 1UL << (MINORBITS - part_shift)) {
err = -EINVAL;
goto misc_out;
}

/*
* If max_loop is specified, create that many devices upfront.
Expand All @@ -1866,8 +1870,10 @@ static int __init loop_init(void)
range = 1UL << MINORBITS;
}

if (register_blkdev(LOOP_MAJOR, "loop"))
return -EIO;
if (register_blkdev(LOOP_MAJOR, "loop")) {
err = -EIO;
goto misc_out;
}

blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
THIS_MODULE, loop_probe, NULL, NULL);
Expand All @@ -1880,6 +1886,10 @@ static int __init loop_init(void)

printk(KERN_INFO "loop: module loaded\n");
return 0;

misc_out:
misc_deregister(&loop_misc);
return err;
}

static int loop_exit_cb(int id, void *ptr, void *data)
Expand Down

0 comments on commit 3e19420

Please sign in to comment.