diff mbox series

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

Message ID 20190529013320.GA3307@zhanggen-UX430UQ (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm-init: fix 2 incorrect use of kstrndup() | expand

Commit Message

Gen Zhang May 29, 2019, 1:33 a.m. UTC
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);

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
---
---

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Comments

Bart Van Assche May 29, 2019, 12:23 p.m. UTC | #1
On 5/28/19 6:33 PM, Gen Zhang wrote:
> 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.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Gen Zhang May 29, 2019, 3:24 p.m. UTC | #2
On Wed, May 29, 2019 at 05:23:53AM -0700, Bart Van Assche wrote:
> On 5/28/19 6:33 PM, Gen Zhang wrote:
> > 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.
Personally, I am not quite sure about this question, because I am not 
the maintainer of this part.

Thanks
Gen

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Mike Snitzer May 30, 2019, 4:11 p.m. UTC | #3
On Wed, May 29 2019 at 11:24am -0400,
Gen Zhang <blackgod016574@gmail.com> wrote:

> On Wed, May 29, 2019 at 05:23:53AM -0700, Bart Van Assche wrote:
> > On 5/28/19 6:33 PM, Gen Zhang wrote:
> > > 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.
> 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

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Gen Zhang May 31, 2019, 12:44 a.m. UTC | #4
> 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

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Gen Zhang June 6, 2019, 9:27 a.m. UTC | #5
On Thu, May 30, 2019 at 12:11:03PM -0400, Mike Snitzer wrote:
> On Wed, May 29 2019 at 11:24am -0400,
> Gen Zhang <blackgod016574@gmail.com> wrote:
> 
> > On Wed, May 29, 2019 at 05:23:53AM -0700, Bart Van Assche wrote:
> > > On 5/28/19 6:33 PM, Gen Zhang wrote:
> > > > 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.
> > 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
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

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Gen Zhang June 17, 2019, 9:27 a.m. UTC | #6
On Thu, Jun 06, 2019 at 05:27:25PM +0800, Gen Zhang wrote:
> On Thu, May 30, 2019 at 12:11:03PM -0400, Mike Snitzer wrote:
> > On Wed, May 29 2019 at 11:24am -0400,
> > Gen Zhang <blackgod016574@gmail.com> wrote:
> > 
> > > On Wed, May 29, 2019 at 05:23:53AM -0700, Bart Van Assche wrote:
> > > > On 5/28/19 6:33 PM, Gen Zhang wrote:
> > > > > 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.
> > > 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
> 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

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

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