All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/staging/greybus/bootrom.c: fw is NULL but dereferenced
@ 2021-05-27 23:39 Fabio M. De Francesco
  2021-05-28  3:33 ` Viresh Kumar
  2021-05-28 10:29 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio M. De Francesco @ 2021-05-27 23:39 UTC (permalink / raw)
  To: linux-staging; +Cc: Viresh Kumar, Johan Hovold, Alex Elder, Greg Kroah-Hartman

Coccinelle detected that fw is NULL but dereferenced.

static int gb_bootrom_get_firmware(struct gb_operation *op)
{
/* lines of code */
        if (!fw) {
                dev_err(dev, "%s: firmware not available\n", __func__);
                ret = -EINVAL;
                goto unlock;
        }
/* lines of code */
unlock:
        unlock:
        mutex_unlock(&bootrom->mutex);

queue_work:
        /* Refresh timeout */
        if (!ret && (offset + size == fw->size))    <--- here
	next_request = NEXT_REQ_READY_TO_BOOT;
/* lines of code */
}

I really don't know if the following change may break something else:

        if(!ret && fw && (offset + size == fw->size))
	next_request = NEXT_REQ_READY_TO_BOOT;

So, I'll leave the problem to the maintainers or to other people who know how 
the driver is supposed to manage fw == NULL.

Thanks,

Fabio



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

end of thread, other threads:[~2021-05-28 10:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 23:39 drivers/staging/greybus/bootrom.c: fw is NULL but dereferenced Fabio M. De Francesco
2021-05-28  3:33 ` Viresh Kumar
2021-05-28  8:03   ` Fabio M. De Francesco
2021-05-28 10:42     ` Dan Carpenter
2021-05-28 10:29 ` Dan Carpenter

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.