Skip to contentSkip to conversation

intel/decode: fix couple of warnings

PATCH New Ben Widawsky 1 participant 1 message Jun 27, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel/decode: fix couple of warnings

two instances of
warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations]

---
 intel/intel_decode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
intel/intel_decode.c +3 -2
index c9bfee4..ae0bd27 100644
@@ -2488,7 +2488,7 @@ decode_3d_primitive(struct drm_intel_decode *ctx)
 				goto out;
 			} else {
 				/* fixed size vertex index buffer */
-				for (j = 1, i = 0; i < len; i += 2, j++) {
+				for (j = 1, i = 0; i < len && j; i += 2, j++) {
 					if (i * 2 == len - 1) {
 						instr_out(ctx, j,
 							  "    indices: 0x%04x\n",
@@ -3117,7 +3117,8 @@ decode_3d_965(struct drm_intel_decode *ctx)
 {
 	uint32_t opcode;
 	unsigned int len;
-	unsigned int i, j, sba_len;
+	unsigned int j, sba_len;
+	unsigned short i;
 	const char *desc1 = NULL;
 	uint32_t *data = ctx->data;
 	uint32_t devid = ctx->devid;
Signature · 1 line
1.7.11