2008-04-29 08:10:55

by Holger Schurig

[permalink] [raw]
Subject: [PATCH] libertas: fix use-before-check violation

[PATCH] fix use-before-check violation

According to Coverity (kudo's to Adrian Bunk), we had one use-before-check
bug in libe libertas driver. This patch fixes this issue.

Signed-off-by: Holger Schurig <[email protected]>

Index: wireless-testing/drivers/net/wireless/libertas/scan.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/libertas/scan.c 2008-04-29 09:07:19.000000000 +0200
+++ wireless-testing/drivers/net/wireless/libertas/scan.c 2008-04-29 09:07:39.000000000 +0200
@@ -298,7 +298,8 @@ static int lbs_do_scan(struct lbs_privat
uint8_t *tlv; /* pointer into our current, growing TLV storage area */

lbs_deb_enter_args(LBS_DEB_SCAN, "bsstype %d, chanlist[].chan %d, chan_count %d",
- bsstype, chan_list[0].channumber, chan_count);
+ bsstype, chan_list ? chan_list[0].channumber : -1,
+ chan_count);

/* create the fixed part for scan command */
scan_cmd = kzalloc(MAX_SCAN_CFG_ALLOC, GFP_KERNEL);


2008-04-30 20:25:57

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH] libertas: fix use-before-check violation

On Tue, 2008-04-29 at 10:07 +0200, Holger Schurig wrote:
> [PATCH] fix use-before-check violation
>
> According to Coverity (kudo's to Adrian Bunk), we had one use-before-check
> bug in libe libertas driver. This patch fixes this issue.
>
> Signed-off-by: Holger Schurig <[email protected]>

Acked-by: Dan Williams <[email protected]>

> Index: wireless-testing/drivers/net/wireless/libertas/scan.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/libertas/scan.c 2008-04-29 09:07:19.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/libertas/scan.c 2008-04-29 09:07:39.000000000 +0200
> @@ -298,7 +298,8 @@ static int lbs_do_scan(struct lbs_privat
> uint8_t *tlv; /* pointer into our current, growing TLV storage area */
>
> lbs_deb_enter_args(LBS_DEB_SCAN, "bsstype %d, chanlist[].chan %d, chan_count %d",
> - bsstype, chan_list[0].channumber, chan_count);
> + bsstype, chan_list ? chan_list[0].channumber : -1,
> + chan_count);
>
> /* create the fixed part for scan command */
> scan_cmd = kzalloc(MAX_SCAN_CFG_ALLOC, GFP_KERNEL);