v3d: fix format overflow error
Detected when working on adding support for Undefined Behaviour Sanitizer, this fixes: ``` ../src/gallium/drivers/v3d/v3d_screen.c: In function 'v3d_get_compute_param.part.0': ../src/gallium/drivers/v3d/v3d_screen.c:480:17: error: null destination pointer [-Werror=format-overflow=] 480 | sprintf(ret, "v3d"); | ^~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors ``` Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30880>
This commit is contained in:

committed by
Marge Bot

parent
0114d293fc
commit
e54a15f700
@@ -449,6 +449,7 @@ v3d_get_compute_param(struct pipe_screen *pscreen, enum pipe_shader_ir ir_type,
|
||||
enum pipe_compute_cap param, void *ret)
|
||||
{
|
||||
struct v3d_screen *screen = v3d_screen(pscreen);
|
||||
const char *const ir = "v3d";
|
||||
|
||||
if (!screen->has_csd)
|
||||
return 0;
|
||||
@@ -465,8 +466,9 @@ v3d_get_compute_param(struct pipe_screen *pscreen, enum pipe_shader_ir ir_type,
|
||||
break;
|
||||
|
||||
case PIPE_COMPUTE_CAP_IR_TARGET:
|
||||
sprintf(ret, "v3d");
|
||||
return strlen(ret);
|
||||
if (ret)
|
||||
sprintf(ret, "%s", ir);
|
||||
return strlen(ir) * sizeof(char);
|
||||
|
||||
case PIPE_COMPUTE_CAP_GRID_DIMENSION:
|
||||
RET((uint64_t []) { 3 });
|
||||
|
Reference in New Issue
Block a user