2019-05-29 01:35:02

by Gen Zhang

[permalink] [raw]
Subject: [PATCH] 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);

Signed-off-by: Gen Zhang <[email protected]>
---
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;

---


2019-05-29 12:25:33

by Bart Van Assche

[permalink] [raw]
Subject: Re: [dm-devel] [PATCH] dm-init: fix 2 incorrect use of kstrndup()

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.

2019-05-29 15:27:44

by Gen Zhang

[permalink] [raw]
Subject: Re: [dm-devel] [PATCH] dm-init: fix 2 incorrect use of kstrndup()

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

2019-05-30 16:12:45

by Mike Snitzer

[permalink] [raw]
Subject: Re: dm-init: fix 2 incorrect use of kstrndup()

On Wed, May 29 2019 at 11:24am -0400,
Gen Zhang <[email protected]> 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

2019-05-31 00:46:13

by Gen Zhang

[permalink] [raw]
Subject: Re: dm-init: fix 2 incorrect use of kstrndup()

> 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

2019-06-06 11:55:11

by Gen Zhang

[permalink] [raw]
Subject: Re: dm-init: fix 2 incorrect use of kstrndup()

On Thu, May 30, 2019 at 12:11:03PM -0400, Mike Snitzer wrote:
> On Wed, May 29 2019 at 11:24am -0400,
> Gen Zhang <[email protected]> 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

2019-06-17 09:27:44

by Gen Zhang

[permalink] [raw]
Subject: Re: dm-init: fix 2 incorrect use of kstrndup()

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 <[email protected]> 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