Re: [PATCH v2] staging:gpib: Fix a dereference before null check issue
From: Dan Carpenter
Date: Thu Nov 21 2024 - 14:05:34 EST
On Thu, Nov 21, 2024 at 04:22:21PM +0100, Paolo Perego wrote:
> This commit fixes a dereference before null check issue discovered by
> Coverity (CID 1601566).
>
> The check at line 1450 suggests that a_priv can be NULL, however it has
> been dereferenced before, in the interface_to_usbdev() call.
>
> After a discussion, the NULL check is useless because private data is allocated
> in attach routine and freed in detach routine, so in detach routine the pointer
> has to be not NULL for sure.
>
> Signed-off-by: Paolo Perego <pperego@xxxxxxx>
> Fixes: Removes a useless NULL check
This isn't how the Fixes tag works. It's supposed to refer to the patch which
introduces the static checker warning.
Fixes: fbae7090f30c ("staging: gpib: Update messaging and usb_device refs in agilent_usb")
The patch has a couple checkpatch issues as well. Please, fix those up and
resend.
regards,
dan carpenter