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

From: Everest K.C.
Date: Thu Oct 10 2024 - 02:34:47 EST


On Thu, Oct 10, 2024 at 12:28 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxxxxxx>
> > ---
>
> Otherwise, it looks good.
Will incorporate your feedback and will send a V3.
Thank you for taking time to review it.
> Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> regards,
> dan carpenter
>
Thanks,
Everest K.C.