Skip to content

Commit

Permalink
dm init: fix incorrect uses of kstrndup()
Browse files Browse the repository at this point in the history
Fix 2 kstrndup() calls with incorrect argument order.

Fixes: 6bbc923 ("dm: add support to directly boot to a mapped device")
Cc: stable@vger.kernel.org # v5.1
Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Gen Zhang authored and Mike Snitzer committed Jun 25, 2019
1 parent 9e0babf commit dec7e64
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/md/dm-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ static char __init *dm_parse_table_entry(struct dm_device *dev, char *str)
return ERR_PTR(-EINVAL);
}
/* target_args */
dev->target_args_array[n] = kstrndup(field[3], GFP_KERNEL,
DM_MAX_STR_SIZE);
dev->target_args_array[n] = kstrndup(field[3], DM_MAX_STR_SIZE,
GFP_KERNEL);
if (!dev->target_args_array[n])
return ERR_PTR(-ENOMEM);

Expand Down Expand Up @@ -275,7 +275,7 @@ static int __init dm_init_init(void)
DMERR("Argument is too big. Limit is %d\n", DM_MAX_STR_SIZE);
return -EINVAL;
}
str = kstrndup(create, GFP_KERNEL, DM_MAX_STR_SIZE);
str = kstrndup(create, DM_MAX_STR_SIZE, GFP_KERNEL);
if (!str)
return -ENOMEM;

Expand Down

0 comments on commit dec7e64

Please sign in to comment.