netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: "Rafał Miłecki" <zajec5@gmail.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vivien Didelot" <vivien.didelot@gmail.com>,
	"Vladimir Oltean" <olteanv@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH 1/2] net: dsa: bcm_sf2: add function finding RGMII register
Date: Thu, 18 Mar 2021 09:16:17 -0700	[thread overview]
Message-ID: <e42f1076-7f4a-574a-bce9-726b1b402a9f@gmail.com> (raw)
In-Reply-To: <ebd5018c-35af-60b7-d44b-e583ec18f2e7@gmail.com>



On 3/18/2021 12:30 AM, Rafał Miłecki wrote:
> On 17.03.2021 22:20, Florian Fainelli wrote:
>> On 3/17/2021 7:37 AM, Rafał Miłecki wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>
>>> Simple macro like REG_RGMII_CNTRL_P() is insufficient as:
>>> 1. It doesn't validate port argument
>>> 2. It doesn't support chipsets with non-lineral RGMII regs layout
>>>
>>> Missing port validation could result in getting register offset from out
>>> of array. Random memory -> random offset -> random reads/writes. It
>>> affected e.g. BCM4908 for REG_RGMII_CNTRL_P(7).
>>
>> That is entirely fair, however as a bug fix this is not necessarily the
>> simplest way to approach this.
> 
> I'm not sure if I understand. Should I fix it in some totally different
> way? Or should I just follow your inline suggestions?

What I meant is that for a bug fix you could just mangled the offset of
the register such that REG_RGMII_CNTRL_P(7) would resole to the right
offset. That would be lying a little bit, but for a bug fix, that would
work. Not that it matters since the changes are still fresh in net/net-next.
-- 
Florian

  reply	other threads:[~2021-03-18 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 14:37 [PATCH 0/2] net: dsa: bcm_sf2: refactor & update RGMII regs Rafał Miłecki
2021-03-17 14:37 ` [PATCH 1/2] net: dsa: bcm_sf2: add function finding RGMII register Rafał Miłecki
2021-03-17 21:20   ` Florian Fainelli
2021-03-18  7:30     ` Rafał Miłecki
2021-03-18 16:16       ` Florian Fainelli [this message]
2021-03-17 14:37 ` [PATCH 2/2] net: dsa: bcm_sf2: fix BCM4908 RGMII reg(s) Rafał Miłecki

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=e42f1076-7f4a-574a-bce9-726b1b402a9f@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=vivien.didelot@gmail.com \
    --cc=zajec5@gmail.com \
    /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 NNTP newsgroup(s).