mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] kthread: Fix a NULL vs IS_ERR() bug
@ 2024-12-13 14:25 Dan Carpenter
  2024-12-13 14:43 ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-12-13 14:25 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Andrew Morton, Vlastimil Babka, Chen Yu, Yafang Shao,
	Mickaël Salaün, linux-kernel, kernel-janitors

The kthread_create_worker_on_node() function returns error pointers,
never NULL.  Fix the check to match.

Fixes: e9853c812f86 ("treewide: Introduce kthread_run_worker[_on_cpu]()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 kernel/kthread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 83bf73d2355c..922f15762ec3 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -1124,7 +1124,7 @@ kthread_create_worker_on_cpu(int cpu, unsigned int flags,
 	struct kthread_worker *worker;
 
 	worker = kthread_create_worker_on_node(flags, cpu_to_node(cpu), namefmt, cpu);
-	if (worker)
+	if (!IS_ERR(worker))
 		kthread_bind(worker->task, cpu);
 
 	return worker;
-- 
2.45.2


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

* Re: [PATCH next] kthread: Fix a NULL vs IS_ERR() bug
  2024-12-13 14:25 [PATCH next] kthread: Fix a NULL vs IS_ERR() bug Dan Carpenter
@ 2024-12-13 14:43 ` Frederic Weisbecker
  2024-12-13 14:51   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2024-12-13 14:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Vlastimil Babka, Chen Yu, Yafang Shao,
	Mickaël Salaün, linux-kernel, kernel-janitors

Le Fri, Dec 13, 2024 at 05:25:02PM +0300, Dan Carpenter a écrit :
> The kthread_create_worker_on_node() function returns error pointers,
> never NULL.  Fix the check to match.
> 
> Fixes: e9853c812f86 ("treewide: Introduce kthread_run_worker[_on_cpu]()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  kernel/kthread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 83bf73d2355c..922f15762ec3 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -1124,7 +1124,7 @@ kthread_create_worker_on_cpu(int cpu, unsigned int flags,
>  	struct kthread_worker *worker;
>  
>  	worker = kthread_create_worker_on_node(flags, cpu_to_node(cpu), namefmt, cpu);
> -	if (worker)
> +	if (!IS_ERR(worker))
>  		kthread_bind(worker->task, cpu);

Whoops!

Can I fold this to the offending patch? I can add your
Co-developed-by: / Signed-off-by: ?

Thanks.

>  
>  	return worker;
> -- 
> 2.45.2
> 

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

* Re: [PATCH next] kthread: Fix a NULL vs IS_ERR() bug
  2024-12-13 14:43 ` Frederic Weisbecker
@ 2024-12-13 14:51   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-12-13 14:51 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Andrew Morton, Vlastimil Babka, Chen Yu, Yafang Shao,
	Mickaël Salaün, linux-kernel, kernel-janitors

On Fri, Dec 13, 2024 at 03:43:13PM +0100, Frederic Weisbecker wrote:
> Le Fri, Dec 13, 2024 at 05:25:02PM +0300, Dan Carpenter a écrit :
> > The kthread_create_worker_on_node() function returns error pointers,
> > never NULL.  Fix the check to match.
> > 
> > Fixes: e9853c812f86 ("treewide: Introduce kthread_run_worker[_on_cpu]()")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> >  kernel/kthread.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/kthread.c b/kernel/kthread.c
> > index 83bf73d2355c..922f15762ec3 100644
> > --- a/kernel/kthread.c
> > +++ b/kernel/kthread.c
> > @@ -1124,7 +1124,7 @@ kthread_create_worker_on_cpu(int cpu, unsigned int flags,
> >  	struct kthread_worker *worker;
> >  
> >  	worker = kthread_create_worker_on_node(flags, cpu_to_node(cpu), namefmt, cpu);
> > -	if (worker)
> > +	if (!IS_ERR(worker))
> >  		kthread_bind(worker->task, cpu);
> 
> Whoops!
> 
> Can I fold this to the offending patch? I can add your
> Co-developed-by: / Signed-off-by: ?

Sure.  Just add my Signed-off-by probably.  Co-developed-by seems too
much.

regards,
dan carpenter


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

end of thread, other threads:[~2024-12-13 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 14:25 [PATCH next] kthread: Fix a NULL vs IS_ERR() bug Dan Carpenter
2024-12-13 14:43 ` Frederic Weisbecker
2024-12-13 14:51   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®