Re: drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.

From: Dan Carpenter
Date: Wed Oct 30 2019 - 04:19:26 EST


On Sat, Oct 26, 2019 at 11:41:41AM +0900, Suwan Kim wrote:
> On Thu, Oct 24, 2019 at 04:52:52PM -0600, shuah wrote:
> > On 10/24/19 1:45 PM, Dan Carpenter wrote:
> > > On Wed, Oct 23, 2019 at 04:11:20PM +0900, Suwan Kim wrote:
> > > > On Tue, Oct 22, 2019 at 12:28:39PM +0300, Dan Carpenter wrote:
> > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > > > head: 7d194c2100ad2a6dded545887d02754948ca5241
> > > > > commit: ea44d190764b4422af4d1c29eaeb9e69e353b406 usbip: Implement SG support to vhci-hcd and stub driver
> > > > > date: 7 weeks ago
> > > > >
> > > > > If you fix the issue, kindly add following tag
> > > > > Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> > > > > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > > > >
> > > > > New smatch warnings:
> > > > > drivers/usb/usbip/stub_rx.c:505 stub_recv_cmd_submit() error: uninitialized symbol 'nents'.
> > > > >
> > > > > Old smatch warnings:
> > > > > drivers/usb/usbip/stub_rx.c:450 stub_recv_xbuff() error: uninitialized symbol 'ret'.
>
> Here, ret is not initialized, meaning priv->num_urbs is 0.
> priv->urbs must be greater than zero.
> priv->num_urbs = 0 means nents is 0 (line 505)
>
> Dan, What is the relationship between old and new warnings?
> priv->num_urbs is set as value of "num_urbs" at stub_recv_cmd_submit()
> and "num_urbs" is initialized as 1 first. "num_urbs" will be reset
> only at the place where smatch new warnings happened (line 505).
>
> So, In my opinion, old smatch warnings should occur after the new
> smatch warnings. Does this look right to you?

I don't know exactly how the 0day bot runs Smatch. If you have cross
function analysis enabled then silencing the uninitialized "nents"
warning will also silence the uninitialized "ret" warning.

regards,
dan carpenter