提交 b293acfd 编写于 作者: D David S. Miller

[IRDA]: Use put_unaligned() in irlmp_do_discovery().

irda_device_info->hints[] is byte aligned but is being
accessed as a u16

Based upon a patch by Luke Yang <luke.adi@gmail.com>.
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2c6cc0d8
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
#include <net/irda/irlmp.h> #include <net/irda/irlmp.h>
#include <net/irda/irlmp_frame.h> #include <net/irda/irlmp_frame.h>
#include <asm/unaligned.h>
static __u8 irlmp_find_free_slsap(void); static __u8 irlmp_find_free_slsap(void);
static int irlmp_slsap_inuse(__u8 slsap_sel); static int irlmp_slsap_inuse(__u8 slsap_sel);
...@@ -840,6 +842,7 @@ void irlmp_do_expiry(void) ...@@ -840,6 +842,7 @@ void irlmp_do_expiry(void)
void irlmp_do_discovery(int nslots) void irlmp_do_discovery(int nslots)
{ {
struct lap_cb *lap; struct lap_cb *lap;
__u16 *data_hintsp;
/* Make sure the value is sane */ /* Make sure the value is sane */
if ((nslots != 1) && (nslots != 6) && (nslots != 8) && (nslots != 16)){ if ((nslots != 1) && (nslots != 6) && (nslots != 8) && (nslots != 16)){
...@@ -849,7 +852,8 @@ void irlmp_do_discovery(int nslots) ...@@ -849,7 +852,8 @@ void irlmp_do_discovery(int nslots)
} }
/* Construct new discovery info to be used by IrLAP, */ /* Construct new discovery info to be used by IrLAP, */
u16ho(irlmp->discovery_cmd.data.hints) = irlmp->hints.word; data_hintsp = (__u16 *) irlmp->discovery_cmd.data.hints;
put_unaligned(irlmp->hints.word, data_hintsp);
/* /*
* Set character set for device name (we use ASCII), and * Set character set for device name (we use ASCII), and
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册