Re: [PATCH] Fix an inproper alignment accessing in irda protocol stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Luke Yang" <[email protected]>
Date: Fri, 9 Jun 2006 11:45:06 +0800

>         /* Construct new discovery info to be used by IrLAP, */
> -       u16ho(irlmp->discovery_cmd.data.hints) = irlmp->hints.word;
> +#ifdef __LITTLE_ENDIAN
> +       irlmp->discovery_cmd.data.hints[0] = irlmp->hints.word & 0xff;
> +       irlmp->discovery_cmd.data.hints[1] = (irlmp->hints.word & 0xff00) >> 8;
> +#else /* ifdef __BIG_ENDIAN */
> +       irlmp->discovery_cmd.data.hints[0] = (irlmp->hints.word & 0xff00) >> 8;
> +       irlmp->discovery_cmd.data.hints[1] = irlmp->hints.word & 0xff;
> +#endif

Please don't add ugly ifdefs, they are not necessary.

You can use the le16_to_cpu() macro on the hints.word datum,
then pick out the byte you need, as necessary.  That way you
don't need to use ifdefs.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux