mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
net: caif: fix error code handling
cfpkt_peek_head return 0 and 1, caller is checking error using <0 Signed-off-by: Tong Zhang <ztong0001@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8e4efd4706
commit
e104684108
@ -116,7 +116,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt)
|
|||||||
if (segmented) {
|
if (segmented) {
|
||||||
if (rfml->incomplete_frm == NULL) {
|
if (rfml->incomplete_frm == NULL) {
|
||||||
/* Initial Segment */
|
/* Initial Segment */
|
||||||
if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0)
|
if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rfml->pdu_size = get_unaligned_le16(rfml->seghead+4);
|
rfml->pdu_size = get_unaligned_le16(rfml->seghead+4);
|
||||||
@ -233,7 +233,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
|
|||||||
if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE)
|
if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE)
|
||||||
err = cfpkt_peek_head(pkt, head, 6);
|
err = cfpkt_peek_head(pkt, head, 6);
|
||||||
|
|
||||||
if (err < 0)
|
if (err != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {
|
while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user