Netdev Archive on
help / color / mirror / Atom feed
From: Tony Nguyen <>
Cc: Kees Cook <>,,,
	Tony Brelinski <>
Subject: [PATCH net-next 2/3] igb: Avoid memcpy() over-reading of ETH_SS_STATS
Date: Fri, 23 Jul 2021 10:09:09 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Kees Cook <>

In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally reading across neighboring array fields.

The memcpy() is copying the entire structure, not just the first array.
Adjust the source argument so the compiler can do appropriate bounds

Signed-off-by: Kees Cook <>
Tested-by: Tony Brelinski <>
Signed-off-by: Tony Nguyen <>
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 636a1b1fb7e1..17f5c003c3df 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2343,8 +2343,7 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 	switch (stringset) {
 	case ETH_SS_TEST:
-		memcpy(data, *igb_gstrings_test,
+		memcpy(data, igb_gstrings_test, sizeof(igb_gstrings_test));
 	case ETH_SS_STATS:
 		for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++)

  parent reply	other threads:[~2021-07-23 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 17:09 [PATCH net-next 0/3][pull request] 1GbE Intel Wired LAN Driver Updates 2021-07-23 Tony Nguyen
2021-07-23 17:09 ` [PATCH net-next 1/3] igb: Add counter to i21x doublecheck Tony Nguyen
2021-07-23 17:09 ` Tony Nguyen [this message]
2021-07-23 17:09 ` [PATCH net-next 3/3] e100: Avoid memcpy() over-reading of ETH_SS_STATS Tony Nguyen
2021-07-23 20:30 ` [PATCH net-next 0/3][pull request] 1GbE Intel Wired LAN Driver Updates 2021-07-23 patchwork-bot+netdevbpf

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:

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

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH net-next 2/3] igb: Avoid memcpy() over-reading of ETH_SS_STATS' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).