[Mesa-dev] [PATCH] radeonsi: fix possible truncation on renderer string

Michel Dänzer michel at daenzer.net
Thu Jun 7 10:07:28 UTC 2018


On 2018-06-07 03:03 AM, Timothy Arceri wrote:
> Fixes truncation warning in gcc 8.1
> 
> Fixes: 8539c9bf3158 ("gallium/radeon: add the kernel version into the renderer string")
> ---
>  src/gallium/drivers/radeonsi/si_pipe.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
> index 5d1671fb87f..cf9b124fe5a 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.h
> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
> @@ -409,7 +409,7 @@ struct si_screen {
>  
>  	struct radeon_info		info;
>  	uint64_t			debug_flags;
> -	char				renderer_string[100];
> +	char				renderer_string[183];
>  
>  	unsigned			gs_table_depth;
>  	unsigned			tess_offchip_block_dw_size;
> 

si_init_renderer_string has:

	snprintf(sscreen->renderer_string, sizeof(sscreen->renderer_string),
		 ...

My understanding from the snprintf manpage is that snprintf should never
write more than sizeof(sscreen->renderer_string) bytes. Does that give
the wrong size?

Either way though, not sure how this patch could make a difference.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list