Message ID | 20111121061722.GD7354@elgon.mountain |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, Nov 21, 2011 at 09:17:22AM +0300, Dan Carpenter wrote: > 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. Charming... On b-e we end up feeding zeroes instead of the value we want. However, that u16 clearly ought to be __le16 - it's there for purpose. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Dan, > 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> Looks OK by me, unless you want to make sparse with __CHECK_ENDIAN__ shut up, then you should use __le16 ;-) Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Regards, Sjur -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html