LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] kdbus: checking for IS_ERR() instead of NULL
@ 2015-04-22 13:39 Dan Carpenter
  2015-04-22 17:35 ` David Herrmann
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-04-22 13:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Daniel Mack, David Herrmann, Djalal Harouni, linux-kernel,
	kernel-janitors

"e->user" is never assigned an ERR_PTR().  It can be set to NULL so I
assume that is what is intended here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/ipc/kdbus/queue.c b/ipc/kdbus/queue.c
index a449464..21fce62 100644
--- a/ipc/kdbus/queue.c
+++ b/ipc/kdbus/queue.c
@@ -637,7 +637,7 @@ int kdbus_queue_entry_move(struct kdbus_queue_entry *e,
 	lockdep_assert_held(&src->lock);
 	lockdep_assert_held(&dst->lock);
 
-	if (WARN_ON(IS_ERR(e->user)) || WARN_ON(list_empty(&e->entry)))
+	if (WARN_ON(!e->user) || WARN_ON(list_empty(&e->entry)))
 		return -EINVAL;
 	if (src == dst)
 		return 0;

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

* Re: [patch] kdbus: checking for IS_ERR() instead of NULL
  2015-04-22 13:39 [patch] kdbus: checking for IS_ERR() instead of NULL Dan Carpenter
@ 2015-04-22 17:35 ` David Herrmann
  2015-04-22 18:44   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: David Herrmann @ 2015-04-22 17:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, Daniel Mack, David Herrmann, Djalal Harouni,
	linux-kernel, kernel-janitors

Hi

On Wed, Apr 22, 2015 at 3:39 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> "e->user" is never assigned an ERR_PTR().  It can be set to NULL so I
> assume that is what is intended here.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/ipc/kdbus/queue.c b/ipc/kdbus/queue.c
> index a449464..21fce62 100644
> --- a/ipc/kdbus/queue.c
> +++ b/ipc/kdbus/queue.c
> @@ -637,7 +637,7 @@ int kdbus_queue_entry_move(struct kdbus_queue_entry *e,
>         lockdep_assert_held(&src->lock);
>         lockdep_assert_held(&dst->lock);
>
> -       if (WARN_ON(IS_ERR(e->user)) || WARN_ON(list_empty(&e->entry)))
> +       if (WARN_ON(!e->user) || WARN_ON(list_empty(&e->entry)))

e->user is allowed to be NULL (eg., for kernel notifications). We used
to set it to ERR_PTR(foobar), but that's long gone. This WARN_ON() can
simply be dropped.

I wrote a patch [1] and will send it to Greg later.

Thanks
David

[1] http://cgit.freedesktop.org/~dvdhrm/linux/commit/?h=kdbus&id=eb132dd85d4e882a9b3ad07497b26d1b55cab893

>                 return -EINVAL;
>         if (src == dst)
>                 return 0;

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

* Re: [patch] kdbus: checking for IS_ERR() instead of NULL
  2015-04-22 17:35 ` David Herrmann
@ 2015-04-22 18:44   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-04-22 18:44 UTC (permalink / raw)
  To: David Herrmann
  Cc: Greg Kroah-Hartman, Daniel Mack, David Herrmann, Djalal Harouni,
	linux-kernel, kernel-janitors

Sorry, I should have just reported this instead of introducing a bug.
Thanks for fixing it properly.

regards,
dan carpenter


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

end of thread, other threads:[~2015-04-22 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 13:39 [patch] kdbus: checking for IS_ERR() instead of NULL Dan Carpenter
2015-04-22 17:35 ` David Herrmann
2015-04-22 18:44   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).