public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libertas: Read outside array bounds
@ 2009-07-28  7:59 Roel Kluin
  2009-07-28  8:13 ` Holger Schurig
  2009-07-28 20:22 ` Dan Williams
  0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-07-28  7:59 UTC (permalink / raw)
  To: dcbw, libertas-dev, linux-wireless, Andrew Morton

reads bss->rates[j] before checking bounds of index, and should use
ARRAY_SIZE to determine the size of the array.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 601b542..6c95af3 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -5,6 +5,7 @@
   *  for sending scan commands to the firmware.
   */
 #include <linux/types.h>
+#include <linux/kernel.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <asm/unaligned.h>
@@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
 	iwe.u.bitrate.disabled = 0;
 	iwe.u.bitrate.value = 0;
 
-	for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) {
+	for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) {
 		/* Bit rate given in 500 kb/s units */
 		iwe.u.bitrate.value = bss->rates[j] * 500000;
 		current_val = iwe_stream_add_value(info, start, current_val,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libertas: Read outside array bounds
  2009-07-28  7:59 [PATCH] libertas: Read outside array bounds Roel Kluin
@ 2009-07-28  8:13 ` Holger Schurig
  2009-07-28 20:22 ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Holger Schurig @ 2009-07-28  8:13 UTC (permalink / raw)
  To: Roel Kluin; +Cc: dcbw, libertas-dev, linux-wireless, Andrew Morton

Acked-by: Holger Schurig <hs4233@mail.mn-solutions.de>

-- 
http://www.holgerschurig.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libertas: Read outside array bounds
  2009-07-28  7:59 [PATCH] libertas: Read outside array bounds Roel Kluin
  2009-07-28  8:13 ` Holger Schurig
@ 2009-07-28 20:22 ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2009-07-28 20:22 UTC (permalink / raw)
  To: Roel Kluin; +Cc: libertas-dev, linux-wireless, Andrew Morton

On Tue, 2009-07-28 at 09:59 +0200, Roel Kluin wrote:
> reads bss->rates[j] before checking bounds of index, and should use
> ARRAY_SIZE to determine the size of the array.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Acked-by: Dan Williams <dcbw@redhat.com>

> ---
> diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
> index 601b542..6c95af3 100644
> --- a/drivers/net/wireless/libertas/scan.c
> +++ b/drivers/net/wireless/libertas/scan.c
> @@ -5,6 +5,7 @@
>    *  for sending scan commands to the firmware.
>    */
>  #include <linux/types.h>
> +#include <linux/kernel.h>
>  #include <linux/etherdevice.h>
>  #include <linux/if_arp.h>
>  #include <asm/unaligned.h>
> @@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
>  	iwe.u.bitrate.disabled = 0;
>  	iwe.u.bitrate.value = 0;
>  
> -	for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) {
> +	for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) {
>  		/* Bit rate given in 500 kb/s units */
>  		iwe.u.bitrate.value = bss->rates[j] * 500000;
>  		current_val = iwe_stream_add_value(info, start, current_val,


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-28 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-28  7:59 [PATCH] libertas: Read outside array bounds Roel Kluin
2009-07-28  8:13 ` Holger Schurig
2009-07-28 20:22 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox