From 270a543004ef261822cf0312aead015dd5bb3536 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Thu, 1 Feb 2007 16:25:00 +0100 Subject: [PATCH] cistpl: Fix misaligned load Fix a couple of cases where a possibly misaligned pointer is cast to __le16 * and dereferenced. Signed-off-by: Haavard Skinnemoen --- drivers/pcmcia/cistpl.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 912c03e..6bdd249 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -1092,7 +1092,7 @@ static int parse_cftable_entry(tuple_t *tuple, break; case 0x20: entry->mem.nwin = 1; - entry->mem.win[0].len = le16_to_cpu(*(__le16 *)p) << 8; + entry->mem.win[0].len = (p[0] << 8) | (p[1] << 16); entry->mem.win[0].card_addr = 0; entry->mem.win[0].host_addr = 0; p += 2; @@ -1100,9 +1100,8 @@ static int parse_cftable_entry(tuple_t *tuple, break; case 0x40: entry->mem.nwin = 1; - entry->mem.win[0].len = le16_to_cpu(*(__le16 *)p) << 8; - entry->mem.win[0].card_addr = - le16_to_cpu(*(__le16 *)(p+2)) << 8; + entry->mem.win[0].len = (p[0] << 8) | (p[1] << 16); + entry->mem.win[0].card_addr = (p[2] << 8) | (p[3] << 16); entry->mem.win[0].host_addr = 0; p += 4; if (p > q) return CS_BAD_TUPLE; -- 1.4.4.4