summaryrefslogtreecommitdiffstats
path: root/net/caif
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-11-21 16:46:24 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-21 16:46:24 -0500
commitf23aa62545c18728eb2b9434aa258be27e07dd49 (patch)
tree02dc20b820a91d396a6a08818b56733a4bcddb28 /net/caif
parent525c6465d449cdec04b3c91733e46027a4d08422 (diff)
downloadlinux-f23aa62545c18728eb2b9434aa258be27e07dd49.tar.gz
linux-f23aa62545c18728eb2b9434aa258be27e07dd49.tar.bz2
linux-f23aa62545c18728eb2b9434aa258be27e07dd49.zip
caif: fix endian conversion in cffrml_transmit()
The "tmp" variable here is used to store the result of cpu_to_le16() so it should be an __le16 instead of an int. We want the high bits set and the current code works on little endian systems but not on big endian systems. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif')
-rw-r--r--net/caif/cffrml.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c
index f39921171d0d..d3ca87bf23b7 100644
--- a/net/caif/cffrml.c
+++ b/net/caif/cffrml.c
@@ -136,20 +136,21 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt)
{
- int tmp;
u16 chks;
u16 len;
+ __le16 data;
+
struct cffrml *this = container_obj(layr);
if (this->dofcs) {
chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff);
- tmp = cpu_to_le16(chks);
- cfpkt_add_trail(pkt, &tmp, 2);
+ data = cpu_to_le16(chks);
+ cfpkt_add_trail(pkt, &data, 2);
} else {
cfpkt_pad_trail(pkt, 2);
}
len = cfpkt_getlen(pkt);
- tmp = cpu_to_le16(len);
- cfpkt_add_head(pkt, &tmp, 2);
+ data = cpu_to_le16(len);
+ cfpkt_add_head(pkt, &data, 2);
cfpkt_info(pkt)->hdr_len += 2;
if (cfpkt_erroneous(pkt)) {
pr_err("Packet is erroneous!\n");