]> www.infradead.org Git - users/hch/configfs.git/commitdiff
net: ethernet: adi: adin1110: Fix some error handling path in adin1110_read_fifo()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 3 Oct 2024 18:53:15 +0000 (20:53 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 7 Oct 2024 23:49:43 +0000 (16:49 -0700)
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: bc93e19d088b ("net: ethernet: adi: Add ADIN1110 support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/8ff73b40f50d8fa994a454911b66adebce8da266.1727981562.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/adi/adin1110.c

index a98b3139606ade69fbe69243bdbbefe0a15bb3c9..68fad5575fd4f836d4bb985590cd2188306c5be6 100644 (file)
@@ -318,11 +318,11 @@ static int adin1110_read_fifo(struct adin1110_port_priv *port_priv)
         * from the  ADIN1110 frame header.
         */
        if (frame_size < ADIN1110_FRAME_HEADER_LEN + ADIN1110_FEC_LEN)
-               return ret;
+               return -EINVAL;
 
        round_len = adin1110_round_len(frame_size);
        if (round_len < 0)
-               return ret;
+               return -EINVAL;
 
        frame_size_no_fcs = frame_size - ADIN1110_FRAME_HEADER_LEN - ADIN1110_FEC_LEN;
        memset(priv->data, 0, ADIN1110_RD_HEADER_LEN);