diff options
author | Graf Yang <graf.yang@analog.com> | 2008-05-14 02:25:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-14 02:25:57 -0400 |
commit | 332223831e86b2e17b48b4afafad07d8e3b73861 (patch) | |
tree | a3bd42005c91888c3cb20ec0ca6880e3181e7acb /net/irda/discovery.c | |
parent | c1cc678adaa78ae2aab6a6d699241ad516d84476 (diff) |
irda: Fix a misalign access issue. (v2)
Replace u16ho with put/get_unaligned functions
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/discovery.c')
-rw-r--r-- | net/irda/discovery.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/irda/discovery.c b/net/irda/discovery.c index bfacef8b76f4..a6f99b5a1499 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c | |||
@@ -40,6 +40,8 @@ | |||
40 | 40 | ||
41 | #include <net/irda/discovery.h> | 41 | #include <net/irda/discovery.h> |
42 | 42 | ||
43 | #include <asm/unaligned.h> | ||
44 | |||
43 | /* | 45 | /* |
44 | * Function irlmp_add_discovery (cachelog, discovery) | 46 | * Function irlmp_add_discovery (cachelog, discovery) |
45 | * | 47 | * |
@@ -87,7 +89,7 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) | |||
87 | */ | 89 | */ |
88 | hashbin_remove_this(cachelog, (irda_queue_t *) node); | 90 | hashbin_remove_this(cachelog, (irda_queue_t *) node); |
89 | /* Check if hints bits are unchanged */ | 91 | /* Check if hints bits are unchanged */ |
90 | if(u16ho(node->data.hints) == u16ho(new->data.hints)) | 92 | if (get_unaligned((__u16 *)node->data.hints) == get_unaligned((__u16 *)new->data.hints)) |
91 | /* Set time of first discovery for this node */ | 93 | /* Set time of first discovery for this node */ |
92 | new->firststamp = node->firststamp; | 94 | new->firststamp = node->firststamp; |
93 | kfree(node); | 95 | kfree(node); |
@@ -281,9 +283,9 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, | |||
281 | /* Mask out the ones we don't want : | 283 | /* Mask out the ones we don't want : |
282 | * We want to match the discovery mask, and to get only | 284 | * We want to match the discovery mask, and to get only |
283 | * the most recent one (unless we want old ones) */ | 285 | * the most recent one (unless we want old ones) */ |
284 | if ((u16ho(discovery->data.hints) & mask) && | 286 | if ((get_unaligned((__u16 *)discovery->data.hints) & mask) && |
285 | ((old_entries) || | 287 | ((old_entries) || |
286 | ((jiffies - discovery->firststamp) < j_timeout)) ) { | 288 | ((jiffies - discovery->firststamp) < j_timeout))) { |
287 | /* Create buffer as needed. | 289 | /* Create buffer as needed. |
288 | * As this function get called a lot and most time | 290 | * As this function get called a lot and most time |
289 | * we don't have anything to put in the log (we are | 291 | * we don't have anything to put in the log (we are |