Skip to contentSkip to conversation

drm/nouveau: fix WITHIN macro off by one

PATCH In review Pekka Paalanen 2 participants 3 messages Sep 18, 2009 – Sep 20, 2009 2 messages not in the archive

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

PATCH 1/1 drm/nouveau: fix WITHIN macro off by one

Equality in x <= y + z is already out of range. X must be stricly less.

---
 drivers/gpu/drm/nouveau/nouveau_bios.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bios.c +1 -1
index 6afd82e..539835a 100644
@@ -300,7 +300,7 @@ valid_reg(struct nvbios *bios, uint32_t reg)
 	if (dev_priv->card_type >= NV_50)
 		return 1;
 
-	#define WITHIN(x, y, z) ((x >= y) && (x <= y + z))
+	#define WITHIN(x, y, z) ((x >= y) && (x < y + z))
 	if (WITHIN(reg, NV_PMC_OFFSET, NV_PMC_SIZE))
 		return 1;
 	if (WITHIN(reg, NV_PBUS_OFFSET, NV_PBUS_SIZE))
Signature · 1 line
1.6.3.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 2 lines · Pekka Paalanen

Equality in x <= y + z is already out of range. X must be stricly less.

Yeah, I did that back when the SIZE defines were, say, 0x1fff instead of 0x2000 so this was required. Seems like the size defines changed, but the WITHIN macro wasn't updated.

Stephane

A message that is not in the archive (sent off-list or not yet received): 6a89f9d50909200429u234af84l84e4c1eb6e24b287-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 8 lines · On Sun, 20 Sep 2009 13:29:24 +0200 Stephane Marchesin…
Quoted 3 lines · Pekka Paalanen

Equality in x <= y + z is already out of range. X must be stricly less.

Yeah, I did that back when the SIZE defines were, say, 0x1fff instead of 0x2000 so this was required. Seems like the size defines changed, but the WITHIN macro wasn't updated.

Thanks for confirming this, I pushed it a while back.

Signature · 2 lines
Pekka Paalanen
http://www.iki.fi/pq/