diff mbox

[media] hackrf: harmless off by one in debug code

Message ID 20140924103639.GB15107@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Sept. 24, 2014, 10:36 a.m. UTC
My static checker complains that "i" could be one element beyond the end
of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Antti Palosaari Sept. 24, 2014, 10:48 a.m. UTC | #1
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>

Antti

On 09/24/2014 01:36 PM, Dan Carpenter wrote:
> My static checker complains that "i" could be one element beyond the end
> of the array.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c
> index 328b5ba..fd1fa41 100644
> --- a/drivers/media/usb/hackrf/hackrf.c
> +++ b/drivers/media/usb/hackrf/hackrf.c
> @@ -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;
>
diff mbox

Patch

diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c
index 328b5ba..fd1fa41 100644
--- a/drivers/media/usb/hackrf/hackrf.c
+++ b/drivers/media/usb/hackrf/hackrf.c
@@ -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;