diff options
author | Nicolai Hähnle <[email protected]> | 2016-04-29 23:41:59 -0500 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-05-07 16:46:59 -0500 |
commit | b9e6e8e7d4ed9f9330aabc73e0644fe50460cf9e (patch) | |
tree | 4c3156723128e60cb511dc077769cba9420e3e34 /src/gallium/drivers/radeonsi/si_state_shaders.c | |
parent | 146927ce7b7c45be57655af505e8f21e90ae3928 (diff) |
radeonsi: fix undefined behavior (memcpy arguments must be non-NULL)
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_shaders.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 52b9851e01e..0bfd7e8d111 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -63,7 +63,9 @@ static void *si_get_tgsi_binary(struct si_shader_selector *sel) /** Copy "data" to "ptr" and return the next dword following copied data. */ static uint32_t *write_data(uint32_t *ptr, const void *data, unsigned size) { - memcpy(ptr, data, size); + /* data may be NULL if size == 0 */ + if (size) + memcpy(ptr, data, size); ptr += DIV_ROUND_UP(size, 4); return ptr; } |