Re: [PATCH 2/2] media: atomisp: don't use sizeof(NULL)

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

 



Hi,

Le vendredi 02 février 2024 à 10:21 +0100, Hans Verkuil a écrit :
> Check the size of another pointer instead of NULL. This fixes this
> smatch warning:
> 
> drivers/staging/media/atomisp/pci/sh_css.c:3609 ia_css_pipe_enqueue_buffer() warn: sizeof(NUMBER)?
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
> ---
>  drivers/staging/media/atomisp/pci/sh_css.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
> index 1d1fbda75da1..0d2ef96fabce 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css.c
> @@ -3606,7 +3606,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
>  
>  	assert(pipeline || pipe_id == IA_CSS_PIPE_ID_COPY);
>  
> -	assert(sizeof(NULL) <= sizeof(ddr_buffer.kernel_ptr));
> +	assert(sizeof(pipe) <= sizeof(ddr_buffer.kernel_ptr));

have you considered using a static_assert() instead ? There is no run-time value
involved. Also, I personally think this case would be more readable if you used
"sizeof(void*)", even though un-commonly used in Linux.

With or without any changes:
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>

Nicolas

>  	ddr_buffer.kernel_ptr = HOST_ADDRESS(NULL);
>  	ddr_buffer.cookie_ptr = buffer->driver_cookie;
>  	ddr_buffer.timing_data = buffer->timing_data;






[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux