Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 278f7b4f authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a8eeec4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos);
 * @return    Checksum of buffer.
 */

u16 cfpkt_iterate(struct cfpkt *pkt,
int cfpkt_iterate(struct cfpkt *pkt,
		u16 (*iter_func)(u16 chks, void *buf, u16 len),
		u16 data);

+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
	u16 tmp;
	u16 len;
	u16 hdrchks;
	u16 pktchks;
	int pktchks;
	struct cffrml *this;
	this = container_obj(layr);

+3 −3
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ inline u16 cfpkt_getlen(struct cfpkt *pkt)
	return skb->len;
}

inline u16 cfpkt_iterate(struct cfpkt *pkt,
int cfpkt_iterate(struct cfpkt *pkt,
		  u16 (*iter_func)(u16, void *, u16),
		  u16 data)
{