lkml.org 
[lkml]   [2020]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: greybus: fix fw is NULL but dereferenced.
On Sun, Jan 26, 2020 at 02:01:30PM +0530, Saurav Girepunje wrote:
> Fix the warning reported by cocci check.
>
> Changes:
>
> In queue_work fw dereference before it actually get assigned.
> move queue_work before gb_bootrom_set_timeout.

Nope. As I said yesterday, you need to verify the output of any static
checkers you use.

The code may be unnecessarily subtle, but there's no way fw can be
dereferenced before being initialised currently.

> -queue_work:
> /* Refresh timeout */
> if (!ret && (offset + size == fw->size))

Specifically, the second operand is never evaluated if ret is non-zero.

> next_request = NEXT_REQ_READY_TO_BOOT;
> - else
> - next_request = NEXT_REQ_GET_FIRMWARE;
>
> +queue_work:
> gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS);
>
> return ret;

Johan

\
 
 \ /
  Last update: 2020-01-26 12:05    [W:0.063 / U:4.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site