[Intel-gfx] [PATCH V2] drm/i915: assign short type value without a cast

Eric Anholt eric at anholt.net
Fri Jun 5 16:45:41 CEST 2009


On Fri, 2009-05-15 at 16:35 +0800, Ma Ling wrote:
> If CPU force word address is 2 bytes aligned,
> unaligned address access will cause system crash.

What Intel CPU is this the case for?

> 
> Signed-off-by: Simon Farnsworth <simon.farnsworth at onelan.com>
> Signed-off-by: Ma Ling <ling.ma at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index fc28e2b..a463704 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -29,7 +29,7 @@
>  #include "i915_drm.h"
>  #include "i915_drv.h"
>  #include "intel_bios.h"
> -
> +#include <linux/unaligned/le_memmove.h>
>  
>  static void *
>  find_section(struct bdb_header *bdb, int section_id)
> @@ -47,7 +47,7 @@ find_section(struct bdb_header *bdb, int section_id)
>  	while (index < total) {
>  		current_id = *(base + index);
>  		index++;
> -		current_size = *((u16 *)(base + index));
> +		current_size = get_unaligned_le16(base + index);
>  		index += 2;
>  		if (current_id == section_id)
>  			return base + index;
-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090605/ae6eaac8/attachment.sig>


More information about the Intel-gfx mailing list