mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
dm init: fix max devices/targets checks
dm-init should allow up to DM_MAX_{DEVICES,TARGETS} for devices/targets,
and not DM_MAX_{DEVICES,TARGETS} - 1.
Fix the checks and also fix the error message when the number of devices
is surpassed.
Fixes: 6bbc923dfc ("dm: add support to directly boot to a mapped device")
Cc: [email protected]
Signed-off-by: Helen Koike <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
This commit is contained in:
parent
e4f3fabd67
commit
8e890c1ab1
1 changed files with 4 additions and 4 deletions
|
|
@ -160,7 +160,7 @@ static int __init dm_parse_table(struct dm_device *dev, char *str)
|
|||
|
||||
while (table_entry) {
|
||||
DMDEBUG("parsing table \"%s\"", str);
|
||||
if (++dev->dmi.target_count >= DM_MAX_TARGETS) {
|
||||
if (++dev->dmi.target_count > DM_MAX_TARGETS) {
|
||||
DMERR("too many targets %u > %d",
|
||||
dev->dmi.target_count, DM_MAX_TARGETS);
|
||||
return -EINVAL;
|
||||
|
|
@ -242,9 +242,9 @@ static int __init dm_parse_devices(struct list_head *devices, char *str)
|
|||
return -ENOMEM;
|
||||
list_add_tail(&dev->list, devices);
|
||||
|
||||
if (++ndev >= DM_MAX_DEVICES) {
|
||||
DMERR("too many targets %u > %d",
|
||||
dev->dmi.target_count, DM_MAX_TARGETS);
|
||||
if (++ndev > DM_MAX_DEVICES) {
|
||||
DMERR("too many devices %lu > %d",
|
||||
ndev, DM_MAX_DEVICES);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue