lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071211131936.3379f2af@the-village.bc.nu>
Date:	Tue, 11 Dec 2007 13:19:36 +0000
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Richard Knutsson <ricknu-0@...dent.ltu.se>
Cc:	linux-pcmcia@...ts.infradead.org, kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Richard Knutsson <ricknu-0@...dent.ltu.se>
Subject: Re: [PATCH 1/6] pcmcia/3c574_cs: Fix dubious bitfield warning

On Tue, 11 Dec 2007 05:32:38 +0100 (MET)
Richard Knutsson <ricknu-0@...dent.ltu.se> wrote:

> Fixing:
>   CHECK   drivers/net/pcmcia/3c574_cs.c
> drivers/net/pcmcia/3c574_cs.c:194:13: warning: dubious bitfield without explicit `signed' or `unsigned'
> drivers/net/pcmcia/3c574_cs.c:196:14: warning: dubious bitfield without explicit `signed' or `unsigned'
> 
> Signed-off-by: Richard Knutsson <ricknu-0@...dent.ltu.se>
> ---
> Is there a reason for not doing it this way?

How is the endianness handled here (I suspect its always been broken)

> diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
> index ad134a6..97b6daa 100644
> --- a/drivers/net/pcmcia/3c574_cs.c
> +++ b/drivers/net/pcmcia/3c574_cs.c
> @@ -190,10 +190,10 @@ enum Window3 {			/* Window 3: MAC/config bits. */
>  union wn3_config {
>  	int i;
>  	struct w3_config_fields {
> -		unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2;
> -		int pad8:8;
> -		unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1;
> -		int pad24:7;
> +		u8 ram_size:3, ram_width:1, ram_speed:2, rom_size:2;
> +		u8 pad8;
> +		u8 ram_split:2, pad18:2, xcvr:3, pad21:1;
> +		u8 autoselect:1, pad24:7;

Just changing the int pad to unsigned int pad would be safer in terms of
not causing changes. Simply delcaring a 32bit field and bit masks to
and/or into it is probably a lot saner in the general case.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ