public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle•com>
To: Sunil Goutham <sgoutham@marvell•com>,
	hariprasad <hkelam@marvell•com>,
	"Gustavo A. R. Silva" <gustavoars@kernel•org>,
	Christina Jacob <cjacob@marvell•com>
Cc: Geetha sowjanya <gakula@marvell•com>,
	Subbaraya Sundeep <sbhatta@marvell•com>,
	"David S. Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>,
	netdev@vger•kernel.org, kernel-janitors@vger•kernel.org
Subject: [PATCH net-next] octeontx2-pf: Fix otx2_get_fecparam()
Date: Wed, 17 Feb 2021 10:41:39 +0300	[thread overview]
Message-ID: <YCzIsxW3B70g7lea@mwanda> (raw)

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>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 5fe74036a611..f4962a97a075 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -968,7 +968,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;
 }
-- 
2.30.0


             reply	other threads:[~2021-02-17  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17  7:41 Dan Carpenter [this message]
2021-02-17 22:40 ` [PATCH net-next] octeontx2-pf: Fix otx2_get_fecparam() patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YCzIsxW3B70g7lea@mwanda \
    --to=dan.carpenter@oracle$(echo .)com \
    --cc=cjacob@marvell$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=gakula@marvell$(echo .)com \
    --cc=gustavoars@kernel$(echo .)org \
    --cc=hkelam@marvell$(echo .)com \
    --cc=kernel-janitors@vger$(echo .)kernel.org \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sbhatta@marvell$(echo .)com \
    --cc=sgoutham@marvell$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox