]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ionic: use ee->offset when returning sprom data
authorShannon Nelson <shannon.nelson@amd.com>
Thu, 12 Dec 2024 21:31:57 +0000 (13:31 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:28:31 +0000 (13:28 +0100)
[ Upstream commit b096d62ba1323391b2db98b7704e2468cf3b1588 ]

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>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20241212213157.12212-4-shannon.nelson@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c

index 2fa116c3694c4cc951a2392ded69a1cdfc63ee02..8d459d563416084a5f2d34452312b87c9aed48c6 100644 (file)
@@ -861,8 +861,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);
 
                /* Let's make sure we got a consistent copy */
                if (!memcmp(data, tbuf, len))