Re: staging: most: warning: âmboâ may be used uninitialized in this function

From: Dan Carpenter
Date: Fri Mar 18 2016 - 09:03:07 EST


On Fri, Mar 18, 2016 at 01:41:19PM +0100, Geert Uytterhoeven wrote:
> > @@ -249,11 +246,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
> > struct aim_channel *c = filp->private_data;
> >
> > mutex_lock(&c->io_mutex);
> > - if (c->stacked_mbo) {
> > - mbo = c->stacked_mbo;
> > - goto start_copy;
> > - }
> > - while ((!kfifo_out(&c->fifo, &mbo, 1)) && (c->dev)) {
> > + while (c->dev && !kfifo_peek(&c->fifo, &mbo)) {
>
> drivers/staging/most/aim-cdev/cdev.c:241: warning: âmboâ may be used
> uninitialized in this function
>
> From looking at the code, it's not obvious to me if this is a false
> positive or not.
> Can it happen that mbo is not initialized fully, e.g. if less than sizeof(mbo)
> bytes have been read from the kfifo?
>
> Other callers initialize the pointer to NULL, and check the returned length.
>

It looks like a false positive to me.

regards,
dan carpenter