From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753856AbbDVRfO (ORCPT ); Wed, 22 Apr 2015 13:35:14 -0400 Received: from mail-qk0-f179.google.com ([209.85.220.179]:35197 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbbDVRfM (ORCPT ); Wed, 22 Apr 2015 13:35:12 -0400 MIME-Version: 1.0 In-Reply-To: <20150422133900.GB29383@mwanda> References: <20150422133900.GB29383@mwanda> Date: Wed, 22 Apr 2015 19:35:11 +0200 Message-ID: Subject: Re: [patch] kdbus: checking for IS_ERR() instead of NULL From: David Herrmann To: Dan Carpenter Cc: Greg Kroah-Hartman , Daniel Mack , David Herrmann , Djalal Harouni , linux-kernel , "kernel-janitors@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On Wed, Apr 22, 2015 at 3:39 PM, Dan Carpenter 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 > > 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;