All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix memdup.cocci warnings
@ 2020-09-22 10:21 ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2020-09-22 10:21 UTC (permalink / raw)
  To: Filipe Manana
  Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
	linux-kernel, kbuild-all

From: kernel test robot <lkp@intel.com>

fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git misc-next
head:   28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06
commit: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 [2/2] btrfs: send, recompute reference path after orphanization of a directory
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago


 send.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3851,10 +3851,9 @@ static int refresh_ref_path(struct send_
 	char *name;
 	int ret;

-	name = kmalloc(ref->name_len, GFP_KERNEL);
+	name = kmemdup(ref->name, ref->name_len, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;
-	memcpy(name, ref->name, ref->name_len);

 	fs_path_reset(ref->full_path);
 	ret = get_cur_path(sctx, ref->dir, ref->dir_gen, ref->full_path);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] btrfs: fix memdup.cocci warnings
@ 2020-09-22 10:21 ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2020-09-22 10:21 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

From: kernel test robot <lkp@intel.com>

fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git misc-next
head:   28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06
commit: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 [2/2] btrfs: send, recompute reference path after orphanization of a directory
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago


 send.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3851,10 +3851,9 @@ static int refresh_ref_path(struct send_
 	char *name;
 	int ret;

-	name = kmalloc(ref->name_len, GFP_KERNEL);
+	name = kmemdup(ref->name, ref->name_len, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;
-	memcpy(name, ref->name, ref->name_len);

 	fs_path_reset(ref->full_path);
 	ret = get_cur_path(sctx, ref->dir, ref->dir_gen, ref->full_path);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: fix memdup.cocci warnings
  2020-09-22 10:21 ` Julia Lawall
  (?)
@ 2020-09-22 13:09 ` Josef Bacik
  -1 siblings, 0 replies; 8+ messages in thread
From: Josef Bacik @ 2020-09-22 13:09 UTC (permalink / raw)
  To: Julia Lawall, Filipe Manana
  Cc: Chris Mason, David Sterba, linux-btrfs, linux-kernel, kbuild-all

On 9/22/20 6:21 AM, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup
> 
>   Use kmemdup rather than duplicating its implementation
> 
> Generated by: scripts/coccinelle/api/memdup.cocci
> 
> Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: fix memdup.cocci warnings
  2020-09-22 10:21 ` Julia Lawall
  (?)
  (?)
@ 2020-09-22 14:05 ` Filipe Manana
  2020-09-22 14:39     ` David Sterba
  -1 siblings, 1 reply; 8+ messages in thread
From: Filipe Manana @ 2020-09-22 14:05 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Filipe Manana, Chris Mason, Josef Bacik, David Sterba,
	linux-btrfs, Linux Kernel Mailing List, kbuild-all

On Tue, Sep 22, 2020 at 11:29 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> From: kernel test robot <lkp@intel.com>
>
> fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup
>
>  Use kmemdup rather than duplicating its implementation
>
> Generated by: scripts/coccinelle/api/memdup.cocci
>
> Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

Since this is not in Linus' tree yet, it can be folded in the original patch.
David, can you do that when you pick it?

Btw, isn't the Fixes tag meant only for bug fixes? This is a pure
cleanup afaics.

Thanks.

> ---
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git misc-next
> head:   28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06
> commit: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 [2/2] btrfs: send, recompute reference path after orphanization of a directory
> :::::: branch date: 17 hours ago
> :::::: commit date: 17 hours ago
>
>
>  send.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -3851,10 +3851,9 @@ static int refresh_ref_path(struct send_
>         char *name;
>         int ret;
>
> -       name = kmalloc(ref->name_len, GFP_KERNEL);
> +       name = kmemdup(ref->name, ref->name_len, GFP_KERNEL);
>         if (!name)
>                 return -ENOMEM;
> -       memcpy(name, ref->name, ref->name_len);
>
>         fs_path_reset(ref->full_path);
>         ret = get_cur_path(sctx, ref->dir, ref->dir_gen, ref->full_path);



-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: fix memdup.cocci warnings
  2020-09-22 14:05 ` Filipe Manana
@ 2020-09-22 14:39     ` David Sterba
  0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2020-09-22 14:39 UTC (permalink / raw)
  To: Filipe Manana
  Cc: Julia Lawall, Filipe Manana, Chris Mason, Josef Bacik,
	David Sterba, linux-btrfs, Linux Kernel Mailing List, kbuild-all

On Tue, Sep 22, 2020 at 03:05:59PM +0100, Filipe Manana wrote:
> On Tue, Sep 22, 2020 at 11:29 AM Julia Lawall <julia.lawall@inria.fr> wrote:
> >
> > From: kernel test robot <lkp@intel.com>
> >
> > fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup
> >
> >  Use kmemdup rather than duplicating its implementation
> >
> > Generated by: scripts/coccinelle/api/memdup.cocci
> >
> > Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
> > Signed-off-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> 
> Since this is not in Linus' tree yet, it can be folded in the original patch.
> David, can you do that when you pick it?

Yes, I'll do that.

> Btw, isn't the Fixes tag meant only for bug fixes? This is a pure
> cleanup afaics.

Agreed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: fix memdup.cocci warnings
@ 2020-09-22 14:39     ` David Sterba
  0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2020-09-22 14:39 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

On Tue, Sep 22, 2020 at 03:05:59PM +0100, Filipe Manana wrote:
> On Tue, Sep 22, 2020 at 11:29 AM Julia Lawall <julia.lawall@inria.fr> wrote:
> >
> > From: kernel test robot <lkp@intel.com>
> >
> > fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup
> >
> >  Use kmemdup rather than duplicating its implementation
> >
> > Generated by: scripts/coccinelle/api/memdup.cocci
> >
> > Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
> > Signed-off-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> 
> Since this is not in Linus' tree yet, it can be folded in the original patch.
> David, can you do that when you pick it?

Yes, I'll do that.

> Btw, isn't the Fixes tag meant only for bug fixes? This is a pure
> cleanup afaics.

Agreed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] btrfs: fix memdup.cocci warnings
  2020-10-13  2:13 [fdmanana:misc-next 2/7] fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup kernel test robot
@ 2020-10-13  2:13 ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-10-13  2:13 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Filipe Manana <fdmanana@suse.com>
CC: Chris Mason <chris.mason@fusionio.com>
CC: Josef Bacik <josef@toxicpanda.com>
CC: David Sterba <dsterba@suse.com>
CC: linux-btrfs(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git misc-next
head:   fdde80f42dc3e822ab990d28d584175eb0ca222f
commit: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 [2/7] btrfs: send, recompute reference path after orphanization of a directory
:::::: branch date: 15 hours ago
:::::: commit date: 3 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 send.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3851,10 +3851,9 @@ static int refresh_ref_path(struct send_
 	char *name;
 	int ret;
 
-	name = kmalloc(ref->name_len, GFP_KERNEL);
+	name = kmemdup(ref->name, ref->name_len, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;
-	memcpy(name, ref->name, ref->name_len);
 
 	fs_path_reset(ref->full_path);
 	ret = get_cur_path(sctx, ref->dir, ref->dir_gen, ref->full_path);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] btrfs: fix memdup.cocci warnings
  2020-09-22  9:36 [fdmanana:misc-next 2/2] fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup kernel test robot
@ 2020-09-22  9:37 ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-09-22  9:37 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Filipe Manana <fdmanana@suse.com>
CC: Chris Mason <chris.mason@fusionio.com>
CC: Josef Bacik <josef@toxicpanda.com>
CC: David Sterba <dsterba@suse.com>
CC: linux-btrfs(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: 28314eb24e6c ("btrfs: send, recompute reference path after orphanization of a directory")
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git misc-next
head:   28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06
commit: 28314eb24e6cb8124d1e5da2ef2ccb90ec44cc06 [2/2] btrfs: send, recompute reference path after orphanization of a directory
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago

Please take the patch only if it's a positive warning. Thanks!

 send.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3851,10 +3851,9 @@ static int refresh_ref_path(struct send_
 	char *name;
 	int ret;
 
-	name = kmalloc(ref->name_len, GFP_KERNEL);
+	name = kmemdup(ref->name, ref->name_len, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;
-	memcpy(name, ref->name, ref->name_len);
 
 	fs_path_reset(ref->full_path);
 	ret = get_cur_path(sctx, ref->dir, ref->dir_gen, ref->full_path);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-13  2:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 10:21 [PATCH] btrfs: fix memdup.cocci warnings Julia Lawall
2020-09-22 10:21 ` Julia Lawall
2020-09-22 13:09 ` Josef Bacik
2020-09-22 14:05 ` Filipe Manana
2020-09-22 14:39   ` David Sterba
2020-09-22 14:39     ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2020-10-13  2:13 [fdmanana:misc-next 2/7] fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup kernel test robot
2020-10-13  2:13 ` [PATCH] btrfs: fix memdup.cocci warnings kernel test robot
2020-09-22  9:36 [fdmanana:misc-next 2/2] fs/btrfs/send.c:3854:8-15: WARNING opportunity for kmemdup kernel test robot
2020-09-22  9:37 ` [PATCH] btrfs: fix memdup.cocci warnings kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.