[Mesa-dev] [PATCH 9/9] radeonsi: fix undefined behavior (memcpy arguments must be non-NULL)
Nicolai Hähnle
nhaehnle at gmail.com
Sat Apr 30 07:24:37 UTC 2016
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/drivers/radeonsi/si_state_shaders.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 52b9851..0bfd7e8 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;
}
--
2.7.4
More information about the mesa-dev
mailing list