Linux-PHY Archive mirror
 help / color / mirror / Atom feed
From: Mikhail Kobuk <m.kobuk@ispras.ru>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: "Mikhail Kobuk" <m.kobuk@ispras.ru>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Marek Behún" <kabel@kernel.org>, "Pali Rohár" <pali@kernel.org>,
	linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org,
	"Alexey Khoroshilov" <khoroshilov@ispras.ru>
Subject: [PATCH 2/2] phy: marvell: a3700-comphy: Fix hardcoded array size
Date: Thu, 21 Mar 2024 19:47:31 +0300	[thread overview]
Message-ID: <20240321164734.49273-2-m.kobuk@ispras.ru> (raw)
In-Reply-To: <20240321164734.49273-1-m.kobuk@ispras.ru>

Replace hardcoded 'gbe_phy_init' array size by explicit one.

Fixes: 934337080c6c ("phy: marvell: phy-mvebu-a3700-comphy: Add native kernel implementation")
Signed-off-by: Mikhail Kobuk <m.kobuk@ispras.ru>
---
 drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
index 41162d7228c9..15bf10710de0 100644
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@@ -603,7 +603,7 @@ static void comphy_gbe_phy_init(struct mvebu_a3700_comphy_lane *lane,
 	u16 val;
 
 	fix_idx = 0;
-	for (addr = 0; addr < 512; addr++) {
+	for (addr = 0; addr < ARRAY_SIZE(gbe_phy_init); addr++) {
 		/*
 		 * All PHY register values are defined in full for 3.125Gbps
 		 * SERDES speed. The values required for 1.25 Gbps are almost
-- 
2.44.0


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2024-03-21 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 16:47 [PATCH 1/2] phy: marvell: a3700-comphy: Fix out of bounds read Mikhail Kobuk
2024-03-21 16:47 ` Mikhail Kobuk [this message]
2024-03-22  7:26   ` [PATCH 2/2] phy: marvell: a3700-comphy: Fix hardcoded array size Miquel Raynal
2024-03-22  7:25 ` [PATCH 1/2] phy: marvell: a3700-comphy: Fix out of bounds read Miquel Raynal
2024-04-05 17:08 ` Vinod Koul

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=20240321164734.49273-2-m.kobuk@ispras.ru \
    --to=m.kobuk@ispras.ru \
    --cc=kabel@kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pali@kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).