All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Subject: Re: [PATCH v2 net-next 5/5] net: dsa: mv88e6xxx: Get mv88e6352 SERDES statistics
Date: Sun, 4 Mar 2018 10:48:43 -0800	[thread overview]
Message-ID: <55c19174-6cb2-bcc8-717f-5538d5622cc9@gmail.com> (raw)
In-Reply-To: <20180302031053.GC12656@lunn.ch>



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

  reply	other threads:[~2018-03-04 18:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  1:02 [PATCH v2 net-next 0/5] Export SERDES stats via ethtool -S Andrew Lunn
2018-03-01  1:02 ` [PATCH v2 net-next 1/5] dsa: Pass the port to get_sset_count() Andrew Lunn
2018-03-01  1:02 ` [PATCH v2 net-next 2/5] net: dsa: mv88e6xxx: Hold mutex while doing stats operations Andrew Lunn
2018-03-01  1:02 ` [PATCH v2 net-next 3/5] net: dsa: mv88e6xxx: Allow the SERDES interfaces to have statistics Andrew Lunn
2018-03-01  1:02 ` [PATCH v2 net-next 4/5] net: dsa: mv88e6xxx: Add helper to determining if port has SERDES Andrew Lunn
2018-03-01  1:02 ` [PATCH v2 net-next 5/5] net: dsa: mv88e6xxx: Get mv88e6352 SERDES statistics Andrew Lunn
2018-03-02  3:10   ` Andrew Lunn
2018-03-04 18:48     ` Florian Fainelli [this message]
2018-03-04 18:35 ` [PATCH v2 net-next 0/5] Export SERDES stats via ethtool -S David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55c19174-6cb2-bcc8-717f-5538d5622cc9@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.