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,
4331
4331
* SFP modules only ever use page 0.
4332
4332
*/
4333
4333
if (page == 0 || !(data [0x2 ] & 0x4 )) {
4334
+ u32 copy_len ;
4335
+
4334
4336
/* If i2c bus is busy due to slow page change or
4335
4337
* link management access, call can fail. This is normal.
4336
4338
* So we retry this a few times.
@@ -4354,8 +4356,8 @@ ice_get_module_eeprom(struct net_device *netdev,
4354
4356
}
4355
4357
4356
4358
/* 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 );
4359
4361
}
4360
4362
}
4361
4363
return 0 ;
You can’t perform that action at this time.
0 commit comments