summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Sinclair <sinclair.jakob@openmailbox.org>2016-05-18 19:48:29 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-05-31 12:51:20 +0200
commit877c00c653ac782f8867a3fee24f16707b1d568c (patch)
tree6ddb24a2e12dbaf1e1cddf6c705b4af7a6da6e54
parent35fd5282ea39a15fab4f7b9639ffe0853a19b415 (diff)
gallium/radeon: fixed division by zero
Coverity is getting a false positive that a division by zero can occur here. This change will silence the Coverity warnings as a division by zero cannot occur in this case. Signed-off-by: Jakob Sinclair <sinclair.jakob@openmailbox.org> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/drivers/radeon/r600_test_dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_test_dma.c b/src/gallium/drivers/radeon/r600_test_dma.c
index c203b4d9a2..1e60f6affa 100644
--- a/src/gallium/drivers/radeon/r600_test_dma.c
+++ b/src/gallium/drivers/radeon/r600_test_dma.c
@@ -345,6 +345,9 @@ void r600_test_dma(struct r600_common_screen *rscreen)
dstx = rand() % (tdst.width0 - width + 1) & ~0x7;
dsty = rand() % (tdst.height0 - height + 1) & ~0x7;
} else {
+ /* just make sure that it doesn't divide by zero */
+ assert(max_width > 0 && max_height > 0);
+
width = (rand() % max_width) + 1;
height = (rand() % max_height) + 1;