Skip to content

Commit 83211ae

Browse files
tititiou36kuba-moo
authored andcommitted
net: ethernet: adi: adin1110: Fix some error handling path in adin1110_read_fifo()
If 'frame_size' is too small or if 'round_len' is an error code, it is likely that an error code should be returned to the caller. Actually, 'ret' is likely to be 0, so if one of these sanity checks fails, 'success' is returned. Return -EINVAL instead. Fixes: bc93e19 ("net: ethernet: adi: Add ADIN1110 support") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://patch.msgid.link/8ff73b40f50d8fa994a454911b66adebce8da266.1727981562.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5546da7 commit 83211ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/adi/adin1110.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,11 @@ static int adin1110_read_fifo(struct adin1110_port_priv *port_priv)
318318
* from the ADIN1110 frame header.
319319
*/
320320
if (frame_size < ADIN1110_FRAME_HEADER_LEN + ADIN1110_FEC_LEN)
321-
return ret;
321+
return -EINVAL;
322322

323323
round_len = adin1110_round_len(frame_size);
324324
if (round_len < 0)
325-
return ret;
325+
return -EINVAL;
326326

327327
frame_size_no_fcs = frame_size - ADIN1110_FRAME_HEADER_LEN - ADIN1110_FEC_LEN;
328328
memset(priv->data, 0, ADIN1110_RD_HEADER_LEN);

0 commit comments

Comments
 (0)