All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings
@ 2020-09-27 13:00 ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-09-27 13:00 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: kbuild-all, linux-kernel, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu,
	linux-kernel

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

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")
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/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
:::::: branch date: 4 hours ago
:::::: commit date: 15 hours ago

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

--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
 				bkvhead[i] = NULL;
 			krc_this_cpu_unlock(krcp, flags);

-			if (bkvhead[i])
-				kfree(bkvhead[i]);
+			kfree(bkvhead[i]);

 			cond_resched_tasks_rcu_qs();
 		}

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

* [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings
@ 2020-09-27 13:00 ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-09-27 13:00 UTC (permalink / raw)
  To: kbuild-all

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

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

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")
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/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
:::::: branch date: 4 hours ago
:::::: commit date: 15 hours ago

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

--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
 				bkvhead[i] = NULL;
 			krc_this_cpu_unlock(krcp, flags);

-			if (bkvhead[i])
-				kfree(bkvhead[i]);
+			kfree(bkvhead[i]);

 			cond_resched_tasks_rcu_qs();
 		}

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

* Re: [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings
  2020-09-27 13:00 ` Julia Lawall
  (?)
@ 2020-09-27 22:55 ` Joel Fernandes
  2020-09-28 14:02     ` Paul E. McKenney
  -1 siblings, 1 reply; 6+ messages in thread
From: Joel Fernandes @ 2020-09-27 22:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Paul E. McKenney, kbuild-all, linux-kernel, Josh Triplett,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, rcu

On Sun, Sep 27, 2020 at 03:00:29PM +0200, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> NULL check before kfree is not needed.
> 
> Generated by: scripts/coccinelle/free/ifnullfree.cocci
> 
> Fixes: e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")
> 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/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
> head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
> commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
> :::::: branch date: 4 hours ago
> :::::: commit date: 15 hours ago
> 
>  tree.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
>  				bkvhead[i] = NULL;
>  			krc_this_cpu_unlock(krcp, flags);
> 
> -			if (bkvhead[i])
> -				kfree(bkvhead[i]);
> +			kfree(bkvhead[i]);
> 

Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel

>  			cond_resched_tasks_rcu_qs();
>  		}

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

* Re: [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings
  2020-09-27 22:55 ` Joel Fernandes
@ 2020-09-28 14:02     ` Paul E. McKenney
  0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2020-09-28 14:02 UTC (permalink / raw)
  To: Joel Fernandes
  Cc: Julia Lawall, kbuild-all, linux-kernel, Josh Triplett,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, rcu

On Sun, Sep 27, 2020 at 06:55:19PM -0400, Joel Fernandes wrote:
> On Sun, Sep 27, 2020 at 03:00:29PM +0200, Julia Lawall wrote:
> > From: kernel test robot <lkp@intel.com>
> > 
> > NULL check before kfree is not needed.
> > 
> > Generated by: scripts/coccinelle/free/ifnullfree.cocci
> > 
> > Fixes: e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")
> > 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/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
> > head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
> > commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
> > :::::: branch date: 4 hours ago
> > :::::: commit date: 15 hours ago
> > 
> >  tree.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
> >  				bkvhead[i] = NULL;
> >  			krc_this_cpu_unlock(krcp, flags);
> > 
> > -			if (bkvhead[i])
> > -				kfree(bkvhead[i]);
> > +			kfree(bkvhead[i]);
> > 
> 
> Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>

Applied and pushed, thank you both!

							Thanx, Paul

> thanks,
> 
>  - Joel
> 
> >  			cond_resched_tasks_rcu_qs();
> >  		}

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

* Re: [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings
@ 2020-09-28 14:02     ` Paul E. McKenney
  0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2020-09-28 14:02 UTC (permalink / raw)
  To: kbuild-all

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

On Sun, Sep 27, 2020 at 06:55:19PM -0400, Joel Fernandes wrote:
> On Sun, Sep 27, 2020 at 03:00:29PM +0200, Julia Lawall wrote:
> > From: kernel test robot <lkp@intel.com>
> > 
> > NULL check before kfree is not needed.
> > 
> > Generated by: scripts/coccinelle/free/ifnullfree.cocci
> > 
> > Fixes: e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")
> > 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/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
> > head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
> > commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
> > :::::: branch date: 4 hours ago
> > :::::: commit date: 15 hours ago
> > 
> >  tree.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
> >  				bkvhead[i] = NULL;
> >  			krc_this_cpu_unlock(krcp, flags);
> > 
> > -			if (bkvhead[i])
> > -				kfree(bkvhead[i]);
> > +			kfree(bkvhead[i]);
> > 
> 
> Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>

Applied and pushed, thank you both!

							Thanx, Paul

> thanks,
> 
>  - Joel
> 
> >  			cond_resched_tasks_rcu_qs();
> >  		}

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

* [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings
  2020-09-27  8:16 [rcu:urezki-pcount.2020.09.26a 17/18] kernel/rcu/tree.c:3169:4-9: WARNING: NULL check before some freeing functions is not needed kernel test robot
@ 2020-09-27  8:16 ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-09-27  8:16 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Paul E. McKenney" <paulmck@kernel.org>
CC: Josh Triplett <josh@joshtriplett.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Lai Jiangshan <jiangshanlai@gmail.com>
CC: Joel Fernandes <joel@joelfernandes.org>
CC: rcu(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

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

kernel/rcu/tree.c:3169:4-9: WARNING: NULL check before some freeing functions is not needed.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
:::::: branch date: 4 hours ago
:::::: commit date: 15 hours ago

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

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

--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
 				bkvhead[i] = NULL;
 			krc_this_cpu_unlock(krcp, flags);
 
-			if (bkvhead[i])
-				kfree(bkvhead[i]);
+			kfree(bkvhead[i]);
 
 			cond_resched_tasks_rcu_qs();
 		}

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

end of thread, other threads:[~2020-09-28 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 13:00 [PATCH] kvfree_rcu(): fix ifnullfree.cocci warnings Julia Lawall
2020-09-27 13:00 ` Julia Lawall
2020-09-27 22:55 ` Joel Fernandes
2020-09-28 14:02   ` Paul E. McKenney
2020-09-28 14:02     ` Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2020-09-27  8:16 [rcu:urezki-pcount.2020.09.26a 17/18] kernel/rcu/tree.c:3169:4-9: WARNING: NULL check before some freeing functions is not needed kernel test robot
2020-09-27  8:16 ` [PATCH] kvfree_rcu(): fix ifnullfree.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.