Skip to contentSkip to conversation

drm/i915: [dinq] Fix six instances of -Warray-bounds

PATCH In review Ben Widawsky 3 participants 6 messages Feb 15, 2012 – Mar 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: [dinq] Fix six instances of -Warray-bounds

Introduced in commits c1cd90ed and d27b1e0e

---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index ae73288..9f1fb33 100644
@@ -704,6 +704,7 @@ static void i915_ring_error_state(struct seq_file *m,
 				  struct drm_i915_error_state *error,
 				  unsigned ring)
 {
+	BUG_ON(ring > VCS);
 	seq_printf(m, "%s command stream:\n", ring_str(ring));
 	seq_printf(m, "  HEAD: 0x%08x\n", error->head[ring]);
 	seq_printf(m, "  TAIL: 0x%08x\n", error->tail[ring]);
Signature · 1 line
1.7.9.1
#1 lore raw

PATCH 2/2 drm/i915: [dinq] fix two instances -Wunitialized

Introduced in commit 8461d226 and 8c59967c

---
 drivers/gpu/drm/i915/i915_gem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index 2031cc7..3059082 100644
@@ -387,7 +387,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev,
 	char __user *user_data;
 	ssize_t remain;
 	loff_t offset;
-	int shmem_page_offset, page_length, ret;
+	int shmem_page_offset, page_length, ret = 0;
 	int obj_do_bit17_swizzling, page_do_bit17_swizzling;
 
 	user_data = (char __user *) (uintptr_t) args->data_ptr;
@@ -794,7 +794,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev,
 	ssize_t remain;
 	loff_t offset;
 	char __user *user_data;
-	int shmem_page_offset, page_length, ret;
+	int shmem_page_offset, page_length, ret = 0;
 	int obj_do_bit17_swizzling, page_do_bit17_swizzling;
 
 	user_data = (char __user *) (uintptr_t) args->data_ptr;
Signature · 1 line
1.7.9.1
#2 lore raw

Re: [PATCH 2/2] drm/i915: [dinq] fix two instances -Wunitialized

Quoted 1 line · Ben Widawsky

Introduced in commit 8461d226 and 8c59967c

I quibble at the word 'fix', since both are merely silencing the compiler. :)
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw

Re: [PATCH 2/2] drm/i915: [dinq] fix two instances -Wunitialized

Quoted 7 lines · On Wed, 15 Feb 2012 13:51:15 +0000 Chris Wilson <[email protected]>…
Quoted 1 line · Ben Widawsky

Introduced in commit 8461d226 and 8c59967c

I quibble at the word 'fix', since both are merely silencing the compiler. :)
-Chris

I think Daniel isn't taking the patches... I'm just sick of seeing the warnings, and having VIM jump to this irrelevant bit after compile.

#4 lore raw

Re: [PATCH 2/2] drm/i915: [dinq] fix two instances -Wunitialized

In reply to Ben Widawsky
Quoted 4 lines · Ben Widawsky

Introduced in commit 8461d226 and 8c59967c

I've merged this two here, but not before adding some grumpy complains about gcc (and doing a s/fix/shut up/ in the commit headlines). -Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#5 lore raw
In reply to Ben Widawsky
Quoted 4 lines · Ben Widawsky

Introduced in commits c1cd90ed and d27b1e0e

This one smells like gcc being stupid - it's in a static function an gcc sees all the callsites and we only pass in a const ring argument. I'll drop that one.

The other one is a bit more fishy, but we do check args->size == 0 before calling into these functions, so we will execute the loop at least once and hence is guaranteed to be initialized. It's harder to check, so gcc has a point here. But this code is scheduled to get completely rewritten anyway, so I'll drop this one, too. I'll re-send the new code in a few days or so.

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48