Mesa (master): etnaviv: Avoid infinite loop in find_frame()
Christian Gmeiner
austriancoder at kemper.freedesktop.org
Tue Jan 31 08:20:13 UTC 2017
Module: Mesa
Branch: master
Commit: 82fe240a9912d78bc2eec513c1139c918c5f189f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=82fe240a9912d78bc2eec513c1139c918c5f189f
Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date: Tue Jan 31 09:10:27 2017 +0100
etnaviv: Avoid infinite loop in find_frame()
Use of unsigned loop control variable with '>= 0' would lead
to infinite loop.
Reported by clang:
etnaviv_compiler.c:1024:39: warning: comparison of unsigned expression
>= 0 is always true [-Wtautological-compare]
for (unsigned sp = c->frame_sp; sp >= 0; sp--)
~~ ^ ~
v2: Simply use the same datatype as c->frame_sp is using.
CC: <mesa-stable at lists.freedesktop.org>
Reported-by: Rhys Kidd <rhyskidd at gmail.com>
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Rhys Kidd <rhyskidd at gmail.com>
---
src/gallium/drivers/etnaviv/etnaviv_compiler.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index 59e1452..dc9af57 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -1021,7 +1021,7 @@ label_mark_use(struct etna_compile *c, struct etna_compile_label *label)
static struct etna_compile_frame *
find_frame(struct etna_compile *c, enum etna_compile_frame_type type)
{
- for (unsigned sp = c->frame_sp; sp >= 0; sp--)
+ for (int sp = c->frame_sp; sp >= 0; sp--)
if (c->frame_stack[sp].type == type)
return &c->frame_stack[sp];
More information about the mesa-commit
mailing list