All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Shannon Nelson <shannon.nelson@amd.com>, <netdev@vger.kernel.org>,
	<davem@davemloft.net>, <kuba@kernel.org>, <edumazet@google.com>,
	<pabeni@redhat.com>, <andrew+netdev@lunn.ch>
Cc: <brett.creeley@amd.com>
Subject: Re: [PATCH net 3/3] ionic: use ee->offset when returning sprom data
Date: Tue, 10 Dec 2024 13:03:35 -0800	[thread overview]
Message-ID: <1887a497-e7da-461d-a0bc-b98bd654e595@intel.com> (raw)
In-Reply-To: <20241210174828.69525-4-shannon.nelson@amd.com>



On 12/10/2024 9:48 AM, Shannon Nelson wrote:
> Some calls into ionic_get_module_eeprom() don't use a single
> full buffer size, but instead multiple calls with an offset.
> Teach our driver to use the offset correctly so we can
> respond appropriately to the caller.
> 
> Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support")
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index dda22fa4448c..9b7f78b6cdb1 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -961,8 +961,8 @@ static int ionic_get_module_eeprom(struct net_device *netdev,
>  	len = min_t(u32, sizeof(xcvr->sprom), ee->len);
>  
>  	do {
> -		memcpy(data, xcvr->sprom, len);
> -		memcpy(tbuf, xcvr->sprom, len);
> +		memcpy(data, &xcvr->sprom[ee->offset], len);
> +		memcpy(tbuf, &xcvr->sprom[ee->offset], len);
>  

Makes sense. The eeprom API doesn't require reading the entire EEPROM,
and can use offsets. Previously, you copied always from the beginning
which results in failure to copy the correct data out.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  		/* Let's make sure we got a consistent copy */
>  		if (!memcmp(data, tbuf, len))


      reply	other threads:[~2024-12-10 21:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 17:48 [PATCH net 0/3] ionic: minor code fixes Shannon Nelson
2024-12-10 17:48 ` [PATCH net 1/3] ionic: Fix netdev notifier unregister on failure Shannon Nelson
2024-12-10 20:59   ` Jacob Keller
2024-12-12  4:28     ` Jakub Kicinski
2024-12-12 17:47       ` Nelson, Shannon
2024-12-10 17:48 ` [PATCH net 2/3] ionic: no double destroy workqueue Shannon Nelson
2024-12-10 21:02   ` Jacob Keller
2024-12-10 21:44     ` Nelson, Shannon
2024-12-11 19:23       ` Jacob Keller
2024-12-10 17:48 ` [PATCH net 3/3] ionic: use ee->offset when returning sprom data Shannon Nelson
2024-12-10 21:03   ` Jacob Keller [this message]

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=1887a497-e7da-461d-a0bc-b98bd654e595@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shannon.nelson@amd.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 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.