Re: [PATCH] staging: gpib: Add missing check for NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 20, 2024 at 09:21:43PM +0200, Kees Bakker wrote:
> This was detected by Coverity, CID 1600787
> 
> Signed-off-by: Kees Bakker <kees@xxxxxxxxxxxx>

This is how your patch looks like in lore.
https://lore.kernel.org/all/20241020192243.C6A0F18DA7F@xxxxxxxxxxxxxxxxxx/
The subject and the body of the email are far apart.  It's like a book, right?
The title of the book isn't the first sentence of the book.  Feel free to
restate the subject if necessary.  The commit message should really say the
impact of the bug, (how it looks like to the user) and you need a Fixes tag.

> ---
>  drivers/staging/gpib/common/gpib_os.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c
> index d5860a0a131f..57ff1ed30dac 100644
> --- a/drivers/staging/gpib/common/gpib_os.c
> +++ b/drivers/staging/gpib/common/gpib_os.c
> @@ -1667,6 +1667,8 @@ static int autospoll_ioctl(gpib_board_t *board, gpib_file_private_t *file_priv,
>  		return -EFAULT;
>  
>  	desc = handle_to_descriptor(file_priv, 0); /* board handle is 0 */
> +	if (!desc)
> +		return -EINVAL;

There is always a board 0 so the check is unnecessary.  This kind of heuristic
tends to have a lot of false positives.  It's better to just ignore static
checkers when they are wrong.

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux