Skip to content

Commit

Permalink
net: caif: fix error code handling
Browse files Browse the repository at this point in the history
cfpkt_peek_head return 0 and 1, caller is checking error using <0

Signed-off-by: Tong Zhang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
lzto authored and davem330 committed Aug 25, 2020
1 parent 8e4efd4 commit e104684
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/caif/cfrfml.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt)
if (segmented) {
if (rfml->incomplete_frm == NULL) {
/* Initial Segment */
if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0)
if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0)
goto out;

rfml->pdu_size = get_unaligned_le16(rfml->seghead+4);
Expand Down Expand Up @@ -233,7 +233,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE)
err = cfpkt_peek_head(pkt, head, 6);

if (err < 0)
if (err != 0)
goto out;

while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {
Expand Down

0 comments on commit e104684

Please sign in to comment.