On 03/01/2018 07:10 PM, Andrew Lunn wrote: >> +void mv88e6352_serdes_get_strings(struct mv88e6xxx_chip *chip, >> + int port, uint8_t *data) >> +{ >> + struct mv88e6352_serdes_hw_stat *stat; >> + int i; >> + >> + if (!mv88e6352_port_has_serdes(chip, port)) >> + return; >> + >> + for (i = 0; i < ARRAY_SIZE(mv88e6352_serdes_hw_stats); i++) { >> + stat = &mv88e6352_serdes_hw_stats[i]; >> + memcpy(data + i * ETH_GSTRING_LEN, stat->string, >> + ETH_GSTRING_LEN); > > This has the same problem as Florain just fixed, using memcpy instead > of strcnpy. I will spin a new version with this fixed.
This is fine actually, your strings are defined as an array of ETH_GSTRING_LEN characters so while the memcpy() is a bit inefficient and will typically lead to copying a lot of NUL bytes, this won't be causing out of bounds accesses though. -- Florian