[PATCH V2] drm/xe/guc: Fix dereference before Null check

Dan Carpenter dan.carpenter at linaro.org
Thu Oct 10 06:28:16 UTC 2024


On Wed, Oct 09, 2024 at 03:39:20PM -0600, Everest K.C. wrote:
> The pointer list->list is derefrenced before the Null check.
> Fix this by moving the Null check outside the for loop, so that
> the check is performed before the derefrencing.
> 

Please, mention the effect on runtime if it's not totally obvious.  In this case,
someone reading the commit message would think that it leads to a NULL
dereference but actually the pointer can't be NULL as I explained so there is
no effect on run time.  Say something like:
"The list->list pointer cannot be NULL so this has no effect on runtime.  It's
just a correctness issue."

Change Null to NULL so people don't think it's Java.  ;)  Also dereferencing
has a typo.  s/derefrencing/dereferencing/.


> This issue was reported by Coverity Scan.
> https://scan7.scan.coverity.com/#/project-view/51525/11354
> ?selectedIssue=1600335

Don't line break URLs like this.  Just go over the 72-74 character limit.

> 
> Fixes: a18c696fa5cb ("drm/xe/guc: Fix dereference before Null check")
> 

Remove the blank line after Fixes.

> Signed-off-by: Everest K.C. <everestkc at everestkc.com.np>
> ---

Otherwise, it looks good.

Reviewed-by: Dan Carpenter <dan.carpenter at linaro.org>

regards,
dan carpenter



More information about the Intel-xe mailing list