From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Mikhail Kobuk <m.kobuk@ispras.ru>
Cc: "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: Re: [PATCH 2/2] phy: marvell: a3700-comphy: Fix hardcoded array size
Date: Fri, 22 Mar 2024 08:26:45 +0100 [thread overview]
Message-ID: <20240322082645.6c1d43b5@xps-13> (raw)
In-Reply-To: <20240321164734.49273-2-m.kobuk@ispras.ru>
Hi Mikhail,
m.kobuk@ispras.ru wrote on Thu, 21 Mar 2024 19:47:31 +0300:
> 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
512 is also used where gbe_phy_init is defined, so maybe it would be
worthe defining this size once and then use the definition in both
places.
Thanks, Miquèl
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Mikhail Kobuk <m.kobuk@ispras.ru>
Cc: "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: Re: [PATCH 2/2] phy: marvell: a3700-comphy: Fix hardcoded array size
Date: Fri, 22 Mar 2024 08:26:45 +0100 [thread overview]
Message-ID: <20240322082645.6c1d43b5@xps-13> (raw)
In-Reply-To: <20240321164734.49273-2-m.kobuk@ispras.ru>
Hi Mikhail,
m.kobuk@ispras.ru wrote on Thu, 21 Mar 2024 19:47:31 +0300:
> 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
512 is also used where gbe_phy_init is defined, so maybe it would be
worthe defining this size once and then use the definition in both
places.
Thanks, Miquèl
next prev parent reply other threads:[~2024-03-22 7:26 UTC|newest]
Thread overview: 10+ 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
2024-03-21 16:47 ` [PATCH 2/2] phy: marvell: a3700-comphy: Fix hardcoded array size Mikhail Kobuk
2024-03-21 16:47 ` Mikhail Kobuk
2024-03-22 7:26 ` Miquel Raynal [this message]
2024-03-22 7:26 ` Miquel Raynal
2024-03-22 7:25 ` [PATCH 1/2] phy: marvell: a3700-comphy: Fix out of bounds read Miquel Raynal
2024-03-22 7:25 ` Miquel Raynal
2024-04-05 17:08 ` Vinod Koul
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=20240322082645.6c1d43b5@xps-13 \
--to=miquel.raynal@bootlin.com \
--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=m.kobuk@ispras.ru \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.