DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix module EEPROM read
@ 2022-10-14  5:36 Markus Theil
  2022-10-18  4:09 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Theil @ 2022-10-14  5:36 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang, Qi Zhang, David MacDougal

From: David MacDougal <david.macdougal@gmail.com>

Fix issue with final word being dropped when retrieving module EEPROM
data for the ice driver.

Take for simplicity the case when `info->offset` is zero and `info->len`
is equal to `SFF_READ_BLOCK_SIZE`. In this case, memcpy would not be
called despite there presumably being room in the buffer
(as we have requested 8 bytes of data and the memcpy would write
precisely 8 bytes). The same edge case will be hit on the final
iteration of the for loop whenever a multiple of 8 bytes is requested,
as the final word will not be written to the data buffer.

Signed-off-by: David MacDougal <david.macdougal@gmail.com>
---
 drivers/net/ice/ice_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 8618a3e6b7..7294f38edc 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -5206,7 +5206,7 @@ ice_get_module_eeprom(struct rte_eth_dev *dev,
 			}

 			/* Make sure we have enough room for the new block */
-			if ((i + SFF_READ_BLOCK_SIZE) < info->length)
+			if ((i + SFF_READ_BLOCK_SIZE) <= info->length)
 				memcpy(data + i, value, SFF_READ_BLOCK_SIZE);
 		}
 	}
--
2.38.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] net/ice: fix module EEPROM read
  2022-10-14  5:36 [PATCH] net/ice: fix module EEPROM read Markus Theil
@ 2022-10-18  4:09 ` Zhang, Qi Z
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Qi Z @ 2022-10-18  4:09 UTC (permalink / raw)
  To: Markus Theil, dev; +Cc: Yang, Qiming, David MacDougal



> -----Original Message-----
> From: Markus Theil <markus.theil@tu-ilmenau.de>
> Sent: Friday, October 14, 2022 1:36 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; David MacDougal <david.macdougal@gmail.com>
> Subject: [PATCH] net/ice: fix module EEPROM read
> 
> From: David MacDougal <david.macdougal@gmail.com>
> 
> Fix issue with final word being dropped when retrieving module EEPROM
> data for the ice driver.
> 
> Take for simplicity the case when `info->offset` is zero and `info->len` is
> equal to `SFF_READ_BLOCK_SIZE`. In this case, memcpy would not be called
> despite there presumably being room in the buffer (as we have requested 8
> bytes of data and the memcpy would write precisely 8 bytes). The same edge
> case will be hit on the final iteration of the for loop whenever a multiple of 8
> bytes is requested, as the final word will not be written to the data buffer.
> 

Added:
Fixes: 52569256583a ("net/ice: support module EEPROM")
Cc: stable@dpdk.org

> Signed-off-by: David MacDougal <david.macdougal@gmail.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-18  4:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14  5:36 [PATCH] net/ice: fix module EEPROM read Markus Theil
2022-10-18  4:09 ` Zhang, Qi Z

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).