Commit 6e17b11f authored by Gen Zhang's avatar Gen Zhang Committed by Greg Kroah-Hartman

dm init: fix incorrect uses of kstrndup()

commit dec7e649 upstream.

Fix 2 kstrndup() calls with incorrect argument order.

Fixes: 6bbc923d ("dm: add support to directly boot to a mapped device")
Cc: stable@vger.kernel.org # v5.1
Signed-off-by: default avatarGen Zhang <blackgod016574@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e3d6fe0b
...@@ -140,8 +140,8 @@ static char __init *dm_parse_table_entry(struct dm_device *dev, char *str) ...@@ -140,8 +140,8 @@ static char __init *dm_parse_table_entry(struct dm_device *dev, char *str)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
/* target_args */ /* target_args */
dev->target_args_array[n] = kstrndup(field[3], GFP_KERNEL, dev->target_args_array[n] = kstrndup(field[3], DM_MAX_STR_SIZE,
DM_MAX_STR_SIZE); GFP_KERNEL);
if (!dev->target_args_array[n]) if (!dev->target_args_array[n])
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -275,7 +275,7 @@ static int __init dm_init_init(void) ...@@ -275,7 +275,7 @@ static int __init dm_init_init(void)
DMERR("Argument is too big. Limit is %d\n", DM_MAX_STR_SIZE); DMERR("Argument is too big. Limit is %d\n", DM_MAX_STR_SIZE);
return -EINVAL; return -EINVAL;
} }
str = kstrndup(create, GFP_KERNEL, DM_MAX_STR_SIZE); str = kstrndup(create, DM_MAX_STR_SIZE, GFP_KERNEL);
if (!str) if (!str)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment