Re: [PATCH] fix unaligned exception in /drivers/net/wireless/orinoco.c

John W. Linville
2007-02-02T20:36:12Z

On Thu, Jan 18, 2007 at 09:57:18AM -0000, Hennerich, Michael wrote:
>
> This short patch prevents an unaligned exception to occur. (GCC 4.1)
> tmp is defined as char pointer while it is later accessed as short.
>
> Best regards,
> Michael
>
> Index: linux-2.6.19.2/drivers/net/wireless/orinoco.c
> ===================================================================
> --- linux-2.6.x/drivers/net/wireless/orinoco.c (Revision 2649)
> +++ linux-2.6.x/drivers/net/wireless/orinoco.c (Arbeitskopie)
> @@ -2053,7 +2053,7 @@
> int err;
> struct comp_id nic_id, sta_id;
> unsigned int firmver;
> - char tmp[SYMBOL_MAX_VER_LEN+1];
> + char tmp[SYMBOL_MAX_VER_LEN+1] __attribute__ ((aligned(2)));
>
> /* Get the hardware version */
> err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id);

This patch seems fine, such as it is. But, it seems like it might
also be appropriate to change hermes_read_ltv and/or hermes_read_words
to not take void * parameters? This patch would still be needed,
but it might be more obvious to future coders?

John
--
John W. Linville
linville@tuxdriver.com