Skip to contentSkip to conversation

hackrf: harmless off by one in debug code

PATCH In review Dan Carpenter 2 participants 2 messages Sep 24, 2014

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

PATCH 1/1 hackrf: harmless off by one in debug code

My static checker complains that "i" could be one element beyond the end of the array.

drivers/media/usb/hackrf/hackrf.c +1 -1
index 328b5ba..fd1fa41 100644
@@ -932,7 +932,7 @@ static int hackrf_set_bandwidth(struct hackrf_dev *dev)
 	dev->bandwidth->val = bandwidth;
 	dev->bandwidth->cur.val = bandwidth;
 
-	dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth_lut[i].freq);
+	dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth);
 
 	u16tmp = 0;
 	u16tmp |= ((bandwidth >> 0) & 0xff) << 0;
Acked-by Reviewed-by on v1 1/1
#1 lore raw

Antti

Quoted 19 lines · Dan Carpenter

My static checker complains that "i" could be one element beyond the end of the array.

drivers/media/usb/hackrf/hackrf.c +1 -1
index 328b5ba..fd1fa41 100644
@@ -932,7 +932,7 @@ static int hackrf_set_bandwidth(struct hackrf_dev *dev)
  	dev->bandwidth->val = bandwidth;
  	dev->bandwidth->cur.val = bandwidth;
 
-	dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth_lut[i].freq);
+	dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth);
 
  	u16tmp = 0;
  	u16tmp |= ((bandwidth >> 0) & 0xff) << 0;
Signature · 1 line
http://palosaari.fi/