diff options
| author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-02-19 04:13:13 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-02-20 17:35:14 -0500 |
| commit | 278f7b4fffce9ad267406cf8800df271d14f4a16 (patch) | |
| tree | 7998890a3cedcf7dab3edab58064306734d3707c /net/caif | |
| parent | 5a8eeec468f229558322926f28c61bb0769793e9 (diff) | |
caif: fix a signedness bug in cfpkt_iterate()
The cfpkt_iterate() function can return -EPROTO on error, but the
function is a u16 so the negative value gets truncated to a positive
unsigned short. This causes a static checker warning.
The only caller which might care is cffrml_receive(), when it's checking
the frame checksum. I modified cffrml_receive() so that it never says
-EPROTO is a valid checksum.
Also this isn't ever going to be inlined so I removed the "inline".
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif')
| -rw-r--r-- | net/caif/cffrml.c | 2 | ||||
| -rw-r--r-- | net/caif/cfpkt_skbuff.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c index 8bc7caa28e64..434ba8557826 100644 --- a/net/caif/cffrml.c +++ b/net/caif/cffrml.c | |||
| @@ -84,7 +84,7 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) | |||
| 84 | u16 tmp; | 84 | u16 tmp; |
| 85 | u16 len; | 85 | u16 len; |
| 86 | u16 hdrchks; | 86 | u16 hdrchks; |
| 87 | u16 pktchks; | 87 | int pktchks; |
| 88 | struct cffrml *this; | 88 | struct cffrml *this; |
| 89 | this = container_obj(layr); | 89 | this = container_obj(layr); |
| 90 | 90 | ||
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c index 1be0b521ac49..f6c3b2137eea 100644 --- a/net/caif/cfpkt_skbuff.c +++ b/net/caif/cfpkt_skbuff.c | |||
| @@ -255,9 +255,9 @@ inline u16 cfpkt_getlen(struct cfpkt *pkt) | |||
| 255 | return skb->len; | 255 | return skb->len; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | inline u16 cfpkt_iterate(struct cfpkt *pkt, | 258 | int cfpkt_iterate(struct cfpkt *pkt, |
| 259 | u16 (*iter_func)(u16, void *, u16), | 259 | u16 (*iter_func)(u16, void *, u16), |
| 260 | u16 data) | 260 | u16 data) |
| 261 | { | 261 | { |
| 262 | /* | 262 | /* |
| 263 | * Don't care about the performance hit of linearizing, | 263 | * Don't care about the performance hit of linearizing, |
