2008-10-16 15:46:10

by Larry Finger

[permalink] [raw]
Subject: [PATCH] hostap: Fix sparse warnings

A compilation with the command "make C=2 CF="-D__CHECK_ENDIAN__" \
drivers/net/wireless/hostap/"

yields the following warnings:

CHECK drivers/net/wireless/hostap/hostap_info.c
drivers/net/wireless/hostap/hostap_info.c:156:43: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:156:43: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:156:43: got long *<noident>
drivers/net/wireless/hostap/hostap_info.c:294:44: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:294:44: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:294:44: got long *<noident>
drivers/net/wireless/hostap/hostap_info.c:487:12: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:487:12: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:487:12: got long *<noident>
drivers/net/wireless/hostap/hostap_info.c:491:12: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:491:12: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:491:12: got long *<noident>

The warnings are fixed with the following compile-tested changes:

Signed-off-by: Larry Finger <[email protected]>
---


Index: wireless-testing/drivers/net/wireless/hostap/hostap_info.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/hostap/hostap_info.c
+++ wireless-testing/drivers/net/wireless/hostap/hostap_info.c
@@ -153,7 +153,7 @@ static void prism2_info_linkstatus(local
}

/* Get current BSSID later in scheduled task */
- set_bit(PRISM2_INFO_PENDING_LINKSTATUS, &local->pending_info);
+ set_bit(PRISM2_INFO_PENDING_LINKSTATUS, (ulong *)&local->pending_info);
local->prev_link_status = val;
schedule_work(&local->info_queue);
}
@@ -291,7 +291,7 @@ static void prism2_info_scanresults(loca
hostap_report_scan_complete(local);

/* Perform rest of ScanResults handling later in scheduled task */
- set_bit(PRISM2_INFO_PENDING_SCANRESULTS, &local->pending_info);
+ set_bit(PRISM2_INFO_PENDING_SCANRESULTS, (ulong *)&local->pending_info);
schedule_work(&local->info_queue);
}

@@ -484,11 +484,11 @@ static void handle_info_queue(struct wor
local_info_t *local = container_of(work, local_info_t, info_queue);

if (test_and_clear_bit(PRISM2_INFO_PENDING_LINKSTATUS,
- &local->pending_info))
+ (ulong *)&local->pending_info))
handle_info_queue_linkstatus(local);

if (test_and_clear_bit(PRISM2_INFO_PENDING_SCANRESULTS,
- &local->pending_info))
+ (ulong *)&local->pending_info))
handle_info_queue_scanresults(local);
}
#endif /* PRISM2_NO_STATION_MODES */





2008-10-19 14:30:35

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH V2] hostap: Fix sparse warnings

On Thu, Oct 16, 2008 at 04:44:03PM -0700, Larry Finger wrote:

> CHECK drivers/net/wireless/hostap/hostap_info.c
> drivers/net/wireless/hostap/hostap_info.c:156:43: warning: incorrect type in
> argument 2 (different signedness)
> drivers/net/wireless/hostap/hostap_info.c:156:43: expected unsigned long
> volatile *addr
> drivers/net/wireless/hostap/hostap_info.c:156:43: got long *<noident>

> The warnings are fixed with the following compile-tested fix:
>
> Signed-off-by: Larry Finger <[email protected]>

This V2 looks good.

Acked-by: Jouni Malinen <[email protected]>

--
Jouni Malinen PGP id EFC895FA

2008-10-16 23:44:06

by Larry Finger

[permalink] [raw]
Subject: [PATCH V2] hostap: Fix sparse warnings

A compilation with the command "make C=2 CF="-D__CHECK_ENDIAN__" \
drivers/net/wireless/hostap/"

yields the following warnings:

CHECK drivers/net/wireless/hostap/hostap_info.c
drivers/net/wireless/hostap/hostap_info.c:156:43: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:156:43: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:156:43: got long *<noident>
drivers/net/wireless/hostap/hostap_info.c:294:44: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:294:44: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:294:44: got long *<noident>
drivers/net/wireless/hostap/hostap_info.c:487:12: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:487:12: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:487:12: got long *<noident>
drivers/net/wireless/hostap/hostap_info.c:491:12: warning: incorrect type in
argument 2 (different signedness)
drivers/net/wireless/hostap/hostap_info.c:491:12: expected unsigned long
volatile *addr
drivers/net/wireless/hostap/hostap_info.c:491:12: got long *<noident>

The warnings are fixed with the following compile-tested fix:

Signed-off-by: Larry Finger <[email protected]>
---



Index: wireless-testing/drivers/net/wireless/hostap/hostap_wlan.h
===================================================================
--- wireless-testing.orig/drivers/net/wireless/hostap/hostap_wlan.h
+++ wireless-testing/drivers/net/wireless/hostap/hostap_wlan.h
@@ -822,7 +822,7 @@ struct local_info {
int last_scan_results_count;
enum { PRISM2_SCAN, PRISM2_HOSTSCAN } last_scan_type;
struct work_struct info_queue;
- long pending_info; /* bit field of pending info_queue items */
+ unsigned long pending_info; /* bit field of pending info_queue items */
#define PRISM2_INFO_PENDING_LINKSTATUS 0
#define PRISM2_INFO_PENDING_SCANRESULTS 1
int prev_link_status; /* previous received LinkStatus info */




2008-10-16 23:43:38

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] hostap: Fix sparse warnings

Johannes Berg wrote:
> On Thu, 2008-10-16 at 08:46 -0700, Larry Finger wrote:
>
>> - set_bit(PRISM2_INFO_PENDING_LINKSTATUS, &local->pending_info);
>> + set_bit(PRISM2_INFO_PENDING_LINKSTATUS, (ulong *)&local->pending_info);
>
> Shouldn't you just do this instead?
>
>
> --- hostapd_wlan.h
> +++ hostapd_wlan.h
> @@ ... @@
> - long pending_info;
> + unsigned long pending_info;

Yes. V2 of the patch coming.

Thanks,

Larry


2008-10-16 15:50:36

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] hostap: Fix sparse warnings

On Thu, 2008-10-16 at 08:46 -0700, Larry Finger wrote:

> - set_bit(PRISM2_INFO_PENDING_LINKSTATUS, &local->pending_info);
> + set_bit(PRISM2_INFO_PENDING_LINKSTATUS, (ulong *)&local->pending_info);

Shouldn't you just do this instead?


--- hostapd_wlan.h
+++ hostapd_wlan.h
@@ ... @@
- long pending_info;
+ unsigned long pending_info;

?

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part