From: Dan Carpenter <dan.carpenter@oracle.com>
To: Sjur Braendeland <sjur.brandeland@stericsson.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] caif: fix endian conversion in cffrml_transmit()
Date: Mon, 21 Nov 2011 06:17:22 +0000 [thread overview]
Message-ID: <20111121061722.GD7354@elgon.mountain> (raw)
The "tmp" variable here is used to store the result of cpu_to_le16()
so it should be a u16 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>
---
This is a static checker thing. I haven't tested it. Please review
carefully.
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c
index f399211..2b46c48 100644
--- a/net/caif/cffrml.c
+++ b/net/caif/cffrml.c
@@ -136,10 +136,11 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt)
{
- int tmp;
+ u16 tmp;
u16 chks;
u16 len;
struct cffrml *this = container_obj(layr);
+
if (this->dofcs) {
chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff);
tmp = cpu_to_le16(chks);
next reply other threads:[~2011-11-21 6:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 6:17 Dan Carpenter [this message]
2011-11-21 6:33 ` [patch] caif: fix endian conversion in cffrml_transmit() Al Viro
2011-11-21 19:50 ` [patch v2] " Dan Carpenter
2011-11-21 21:20 ` Sjur Brændeland
2011-11-21 21:46 ` David Miller
2011-11-21 14:36 ` [patch] " Sjur BRENDELAND
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111121061722.GD7354@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sjur.brandeland@stericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox