Skip to contentSkip to conversation

dm-init: fix 2 incorrect use of kstrndup()

PATCH In review Gen Zhang 3 participants 7 messages May 29, 2019 – Jun 17, 2019 Device mapper

lore
Share & tools
lore

Gen Zhang

author
#0 lore raw

PATCH 1/1 dm-init: fix 2 incorrect use of kstrndup()

In drivers/md/dm-init.c, kstrndup() is incorrectly used twice.

It should be: char *kstrndup(const char *s, size_t max, gfp_t gfp);

---

drivers/md/dm-init.c +3 -3
index 352e803..526e261 100644
@@ -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);
 
@@ -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;
 

---

#1 lore raw
Quoted 3 lines · Gen Zhang

In drivers/md/dm-init.c, kstrndup() is incorrectly used twice.

It should be: char *kstrndup(const char *s, size_t max, gfp_t gfp);

Should the following be added to this patch?

Fixes 6bbc923dfcf5 ("dm: add support to directly boot to a mapped

device") # v5.1.
Cc: stable

Thanks,

Bart.

author
#2 lore raw
Quoted 7 lines · Bart Van Assche
Quoted 3 lines · Gen Zhang

In drivers/md/dm-init.c, kstrndup() is incorrectly used twice.

It should be: char *kstrndup(const char *s, size_t max, gfp_t gfp);

Should the following be added to this patch?

Quoted 7 lines
Fixes 6bbc923dfcf5 ("dm: add support to directly boot to a mapped

device") # v5.1.
Cc: stable

Thanks,

Bart.

Personally, I am not quite sure about this question, because I am not the maintainer of this part.

Thanks
Gen

#3 lore raw
Quoted 12 lines · Gen Zhang
Quoted 11 lines · Bart Van Assche
Quoted 3 lines · Gen Zhang

In drivers/md/dm-init.c, kstrndup() is incorrectly used twice.

It should be: char *kstrndup(const char *s, size_t max, gfp_t gfp);

Should the following be added to this patch?

Fixes 6bbc923dfcf5 ("dm: add support to directly boot to a mapped

device") # v5.1.
Cc: stable

Quoted 5 lines
Quoted 3 lines

Thanks,

Bart.

Personally, I am not quite sure about this question, because I am not the maintainer of this part.

Yes, it should have the tags Bart suggested.

I'll take care it.

Thanks,
Mike

author
#4 lore raw
Quoted 6 lines

Yes, it should have the tags Bart suggested.

I'll take care it.

Thanks,
Mike

Thanks for your reply, and please keep me informed if it is applied.

Thanks
Gen

author
#5 lore raw
In reply to Mike Snitzer
Quoted 21 lines · Mike Snitzer
Quoted 12 lines · Gen Zhang
Quoted 11 lines · Bart Van Assche
Quoted 3 lines · Gen Zhang

In drivers/md/dm-init.c, kstrndup() is incorrectly used twice.

It should be: char *kstrndup(const char *s, size_t max, gfp_t gfp);

Should the following be added to this patch?

Fixes 6bbc923dfcf5 ("dm: add support to directly boot to a mapped

device") # v5.1.
Cc: stable

Quoted 5 lines
Quoted 3 lines

Thanks,

Bart.

Personally, I am not quite sure about this question, because I am not the maintainer of this part.

Quoted 6 lines

Yes, it should have the tags Bart suggested.

I'll take care it.

Thanks,
Mike

Hi,
Is there any updates about this patch? I want to check if it is apllied beacause I have to write it down in my paper and the deadline is close.

Thanks
Gen

author
#6 lore raw
Quoted 26 lines · Gen Zhang
Quoted 25 lines · Mike Snitzer
Quoted 12 lines · Gen Zhang
Quoted 11 lines · Bart Van Assche
Quoted 3 lines · Gen Zhang

In drivers/md/dm-init.c, kstrndup() is incorrectly used twice.

It should be: char *kstrndup(const char *s, size_t max, gfp_t gfp);

Should the following be added to this patch?

Fixes 6bbc923dfcf5 ("dm: add support to directly boot to a mapped

device") # v5.1.
Cc: stable

Quoted 5 lines
Quoted 3 lines

Thanks,

Bart.

Personally, I am not quite sure about this question, because I am not the maintainer of this part.

Yes, it should have the tags Bart suggested.

I'll take care it.

Quoted 8 lines
Quoted 2 lines

Thanks,
Mike

Hi,
Is there any updates about this patch? I want to check if it is apllied beacause I have to write it down in my paper and the deadline is close.

Thanks
Gen

Could anyone look into this patch? It's not updated for about 20 days. And I am really on a deadline to get this patch applied.

Thanks
Gen