]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
octeontx2-pf: Fix otx2_get_fecparam()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Feb 2021 07:41:39 +0000 (10:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:48:35 +0000 (19:48 +0100)
commit 38b5133ad607ecdcc8d24906d1ac9cc8df41acd5 upstream.

Static checkers complained about an off by one read overflow in
otx2_get_fecparam() and we applied two conflicting fixes for it.

Correct: b0aae0bde26f ("octeontx2: Fix condition.")
  Wrong: 93efb0c65683 ("octeontx2-pf: Fix out-of-bounds read in otx2_get_fecparam()")

Revert the incorrect fix.

Fixes: 93efb0c65683 ("octeontx2-pf: Fix out-of-bounds read in otx2_get_fecparam()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c

index af230ac44bab60c590a2cecae2e637eee7a4d545..9b6938dde267048c784b5b0aa9c2322fbd4720ab 100644 (file)
@@ -805,7 +805,7 @@ static int otx2_get_fecparam(struct net_device *netdev,
                if (!rsp->fwdata.supported_fec)
                        fecparam->fec = ETHTOOL_FEC_NONE;
                else
-                       fecparam->fec = fec[rsp->fwdata.supported_fec - 1];
+                       fecparam->fec = fec[rsp->fwdata.supported_fec];
        }
        return 0;
 }