[PATCH 1/3] libertas: fix memory alignment problems on the blackfin

Holger Schurig hs4233 at mail.mn-solutions.de
Fri Jan 25 02:53:46 EST 2008


On Thursday 24 January 2008 19:52:11 Ihar Hrachyshka wrote:
> Fixing  unaligned memory access  on the blackfin architecture
> (maybe on the ARM also).
>
> Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka at promwad.com>

NACK

>
> ---
>
> diff --git a/drivers/net/wireless/libertas/scan.c
> b/drivers/net/wireless/libertas/scan.c
> index 9a61188..9e45ba8 100644
> --- a/drivers/net/wireless/libertas/scan.c
> +++ b/drivers/net/wireless/libertas/scan.c
> @@ -755,11 +755,11 @@ static int lbs_process_bss(struct
> bss_descriptor *bss, pos += 8;
>
>         /* beacon interval is 2 bytes long */
> -       bss->beaconperiod = le16_to_cpup((void *) pos);
> +       bss->beaconperiod = le16_to_cpu(get_unaligned((u16
> *)pos)); pos += 2;
>
>         /* capability information is 2 bytes long */
> -       bss->capability = le16_to_cpup((void *) pos);
> +       bss->capability = le16_to_cpu(get_unaligned((u16
> *)pos)); lbs_deb_scan("process_bss: capabilities 0x%04x\n",
> bss->capability); pos += 2;


Compile this with:

$ make modules SUBDIRS=drivers/net/wireless/libertas \
  C=1 CHECKFLAGS="-D__CHECK_ENDIAN__"

and you'll see

  CHECK   drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/scan.c:758:35: warning: incorrect 
type in argument 1 (different base types)
drivers/net/wireless/libertas/scan.c:758:35:    expected 
restricted unsigned short const [usertype] *p
drivers/net/wireless/libertas/scan.c:758:35:    got unsigned 
short [unsigned] [short] [usertype] <noident>
drivers/net/wireless/libertas/scan.c:762:33: warning: incorrect 
type in argument 1 (different base types)
drivers/net/wireless/libertas/scan.c:762:33:    expected 
restricted unsigned short const [usertype] *p
drivers/net/wireless/libertas/scan.c:762:33:    got unsigned 
short [unsigned] [short] [usertype] <noident>
  CC [M]  drivers/net/wireless/libertas/scan.o
drivers/net/wireless/libertas/scan.c: In 
function 'lbs_process_bss':
drivers/net/wireless/libertas/scan.c:758: warning: passing 
argument 1 of '__le16_to_cpup' makes pointer from integer 
without a cast
drivers/net/wireless/libertas/scan.c:762: warning: passing 
argument 1 of '__le16_to_cpup' makes pointer from integer 
without a cast

So we have warnings from sparse AND from gcc 4.1.2.




More information about the libertas-dev mailing list