[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55c19174-6cb2-bcc8-717f-5538d5622cc9@gmail.com>
Date: Sun, 4 Mar 2018 10:48:43 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Andrew Lunn <andrew@...n.ch>, David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Subject: Re: [PATCH v2 net-next 5/5] net: dsa: mv88e6xxx: Get mv88e6352 SERDES
statistics
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
Powered by blists - more mailing lists