File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
drivers/net/ethernet/intel/ice Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -4331,6 +4331,8 @@ ice_get_module_eeprom(struct net_device *netdev,
43314331 * SFP modules only ever use page 0.
43324332 */
43334333 if (page == 0 || !(data [0x2 ] & 0x4 )) {
4334+ u32 copy_len ;
4335+
43344336 /* If i2c bus is busy due to slow page change or
43354337 * link management access, call can fail. This is normal.
43364338 * So we retry this a few times.
@@ -4354,8 +4356,8 @@ ice_get_module_eeprom(struct net_device *netdev,
43544356 }
43554357
43564358 /* Make sure we have enough room for the new block */
4357- if (( i + SFF_READ_BLOCK_SIZE ) < ee -> len )
4358- memcpy (data + i , value , SFF_READ_BLOCK_SIZE );
4359+ copy_len = min_t ( u32 , SFF_READ_BLOCK_SIZE , ee -> len - i );
4360+ memcpy (data + i , value , copy_len );
43594361 }
43604362 }
43614363 return 0 ;
You can’t perform that action at this time.
0 commit comments