All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ran Wang <ran.wang_1@nxp.com>
Cc: "kbuild@lists.01.org" <kbuild@lists.01.org>,
	"lkp@intel.com" <lkp@intel.com>,
	"kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	Peter Chen <peter.chen@nxp.com>
Subject: Re: [kbuild] drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we previously assumed '_ep->desc' could be null (see line 1055)
Date: Tue, 23 Jun 2020 13:36:51 +0300	[thread overview]
Message-ID: <20200623103651.GZ4282@kadam> (raw)
In-Reply-To: <AM6PR04MB54138B87957CFB06EC9DF351F1940@AM6PR04MB5413.eurprd04.prod.outlook.com>

On Tue, Jun 23, 2020 at 02:22:18AM +0000, Ran Wang wrote:
> Hi Dan
> 
> On Tuesday, June 23, 2020 2:20 AM, Dan Carpenter wrote:
> 
> <snip>
> 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > New smatch warnings:
> > drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we
> > previously assumed '_ep->desc' could be null (see line 1055)
> > 
> 
> <snip>
> 
> > 
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1047  static int fsl_ep_fifo_status(struct usb_ep *_ep)
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1048  {
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1049  	struct fsl_ep *ep;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1050  	struct fsl_udc *udc;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1051  	int size = 0;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1052  	u32 bitmask;
> > 6414e94c203d92 drivers/usb/gadget/fsl_udc_core.c     Li Yang
> > 2011-11-23  1053  	struct ep_queue_head *qh;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1054
> > 75eaa498c99eeb drivers/usb/gadget/udc/fsl_udc_core.c Nikhil Badola
> > 2019-10-21 @1055  	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
> >                                          ^^^^^^^^^ Reversed NULL test.  This will always return -ENODEV.  (Or possibly crash.  But I suspect it always returns -ENODEV instead of crashing).
> 
> So the kernel test reports warning in case of '_ep->desc is null', right? 
> 
> My understanding is that this judgement would return -ENODEV when
> executing '... || _ep-desc ||..' and never execute '_ep->desc->bEndpointAddress' part,
> so crash would not happen, am I right?

Yeah.  I can't imagine how _ep->desc is NULL.  It gets set to non-NULL
in fsl_ep_enable() and then set to NULL in fsl_ep_disable().

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we previously assumed '_ep->desc' could be null (see line 1055)
Date: Tue, 23 Jun 2020 13:36:51 +0300	[thread overview]
Message-ID: <20200623103651.GZ4282@kadam> (raw)
In-Reply-To: <AM6PR04MB54138B87957CFB06EC9DF351F1940@AM6PR04MB5413.eurprd04.prod.outlook.com>

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

On Tue, Jun 23, 2020 at 02:22:18AM +0000, Ran Wang wrote:
> Hi Dan
> 
> On Tuesday, June 23, 2020 2:20 AM, Dan Carpenter wrote:
> 
> <snip>
> 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > New smatch warnings:
> > drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we
> > previously assumed '_ep->desc' could be null (see line 1055)
> > 
> 
> <snip>
> 
> > 
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1047  static int fsl_ep_fifo_status(struct usb_ep *_ep)
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1048  {
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1049  	struct fsl_ep *ep;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1050  	struct fsl_udc *udc;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1051  	int size = 0;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1052  	u32 bitmask;
> > 6414e94c203d92 drivers/usb/gadget/fsl_udc_core.c     Li Yang
> > 2011-11-23  1053  	struct ep_queue_head *qh;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1054
> > 75eaa498c99eeb drivers/usb/gadget/udc/fsl_udc_core.c Nikhil Badola
> > 2019-10-21 @1055  	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
> >                                          ^^^^^^^^^ Reversed NULL test.  This will always return -ENODEV.  (Or possibly crash.  But I suspect it always returns -ENODEV instead of crashing).
> 
> So the kernel test reports warning in case of '_ep->desc is null', right? 
> 
> My understanding is that this judgement would return -ENODEV when
> executing '... || _ep-desc ||..' and never execute '_ep->desc->bEndpointAddress' part,
> so crash would not happen, am I right?

Yeah.  I can't imagine how _ep->desc is NULL.  It gets set to non-NULL
in fsl_ep_enable() and then set to NULL in fsl_ep_disable().

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [kbuild] drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we previously assumed '_ep->desc' could be null (see line 1055)
Date: Tue, 23 Jun 2020 13:36:51 +0300	[thread overview]
Message-ID: <20200623103651.GZ4282@kadam> (raw)
In-Reply-To: <AM6PR04MB54138B87957CFB06EC9DF351F1940@AM6PR04MB5413.eurprd04.prod.outlook.com>

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

On Tue, Jun 23, 2020 at 02:22:18AM +0000, Ran Wang wrote:
> Hi Dan
> 
> On Tuesday, June 23, 2020 2:20 AM, Dan Carpenter wrote:
> 
> <snip>
> 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > New smatch warnings:
> > drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we
> > previously assumed '_ep->desc' could be null (see line 1055)
> > 
> 
> <snip>
> 
> > 
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1047  static int fsl_ep_fifo_status(struct usb_ep *_ep)
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1048  {
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1049  	struct fsl_ep *ep;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1050  	struct fsl_udc *udc;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1051  	int size = 0;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1052  	u32 bitmask;
> > 6414e94c203d92 drivers/usb/gadget/fsl_udc_core.c     Li Yang
> > 2011-11-23  1053  	struct ep_queue_head *qh;
> > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c     Anatolij Gustschin
> > 2011-04-18  1054
> > 75eaa498c99eeb drivers/usb/gadget/udc/fsl_udc_core.c Nikhil Badola
> > 2019-10-21 @1055  	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
> >                                          ^^^^^^^^^ Reversed NULL test.  This will always return -ENODEV.  (Or possibly crash.  But I suspect it always returns -ENODEV instead of crashing).
> 
> So the kernel test reports warning in case of '_ep->desc is null', right? 
> 
> My understanding is that this judgement would return -ENODEV when
> executing '... || _ep-desc ||..' and never execute '_ep->desc->bEndpointAddress' part,
> so crash would not happen, am I right?

Yeah.  I can't imagine how _ep->desc is NULL.  It gets set to non-NULL
in fsl_ep_enable() and then set to NULL in fsl_ep_disable().

regards,
dan carpenter

  reply	other threads:[~2020-06-23 10:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 18:20 [kbuild] drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we previously assumed '_ep->desc' could be null (see line 1055) Dan Carpenter
2020-06-22 18:20 ` Dan Carpenter
2020-06-22 18:20 ` Dan Carpenter
2020-06-23  2:22 ` [kbuild] " Ran Wang
2020-06-23 10:36   ` Dan Carpenter [this message]
2020-06-23 10:36     ` Dan Carpenter
2020-06-23 10:36     ` Dan Carpenter
2020-06-23  2:22 ` [kbuild] " Ran Wang
2020-09-01  9:45 Dan Carpenter
2020-09-01  9:45 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200623103651.GZ4282@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=peter.chen@nxp.com \
    --cc=ran.wang_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.