Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3837326pxv; Mon, 28 Jun 2021 14:17:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl/1qO8FwAmml1HS9VGNLnW7L1PsIdmD9Ieb+72tsXztgDFQSIqXcjstq2otS7AEaGMl+G X-Received: by 2002:a02:3705:: with SMTP id r5mr1363534jar.144.1624915028086; Mon, 28 Jun 2021 14:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624915028; cv=none; d=google.com; s=arc-20160816; b=FRFSE+qKt8DWjkNUDp/p+W5dZszYvCY/IDS+95SBjIwSotlGMeHZW33FC36dmqcKhP KG3e0gT/e8tlcC6y59UP9X22lyLxPeenAu3NXDbKGxnzkYtdZp83gZ2oFqfQwIcH85Di eXGTExdaAHj1Q8mhApzQd5rFVmXhtUNr50kgwKYG8v9Avtl2Y5VN3/cLRNh71T1JcN1G STJaANht15G4A8aM9U2Vk9vUeZbsC+DauUHgJarM9nyvNLWOw9DMLzFR4kX6RCm1YYaL UT4mg0p4JWXpB8zhikMroCsNu2gEps/OwSkygL0vfrPVSZA0zc+0sgv4yggvJHmu9Xvv aAng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I1NDNpM2Vb7rhfhvshDt87yML6jOFFTvqmr3wo9CJFo=; b=Uiv3bljTW4DGHcZmCmE0FvDUSb/7nhN97sWuTmraDT4LoqvbJKf4pM6F8KZQGNJGZW FE9N1AUXKCjMLoPWccxu1OyReTe3JCWr/uEt8tYeHd2exk6I4JbPT/0pRZyh5Vs2IQhL 6O7Yt4z6KqIobfyeUWLrV07Hq95MCBRb1i7RHRWNgY30rg0EVwHQHRpIxciNFeBJS7Xf NVhdouEsHGZppySgUHfYF3LOLbaDxnIWe8lwCp9/DjDZoD0OS9P0Cje040VRAcVZvJkk XyDeyCNgPSrYYWwmTYIZ0zyaPnCemXg3bGddseQTsLdSdtbCT2JttSeZqhyyAhKJTVfC 3HJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r5Jt+JZx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u8si10992768ill.90.2021.06.28.14.16.55; Mon, 28 Jun 2021 14:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r5Jt+JZx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236079AbhF1PQa (ORCPT + 99 others); Mon, 28 Jun 2021 11:16:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:59740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236214AbhF1OzC (ORCPT ); Mon, 28 Jun 2021 10:55:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 16DA261CC1; Mon, 28 Jun 2021 14:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891060; bh=2IKbnHxMDnVBoUTL2DIlZzBwzV8l8nQCh3hScq+Pc10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5Jt+JZxDJjNNpiKTL3lHh5bmi2BFjy6GBBO9ODy/vEoZwt5dNfPkaG8OYkyO/UQi vx5VIasOIFlC2WoTTypzA4vkCc+x0nWoHAb8iCKCO4CqaXm35OihJY1fhCAHtOkfo/ 0yFAUrxEFcyI/VwEla/5kvFwAtDozkgk8XYV3A/LQrZgHB/L7tNpOkcoB5fWg0hp5k YxglKKTHaqKjU9Y1NXeS6mbYEA6w11iPjtCfmsFrbw8X8va9v4mf6ia5ruUq6kL0rW PPMraU4faEmQbCHm+b1GJUjwEvGZVskVlZ+4oj2YGLbzswpNe1r79MY3NyIbCMcE/C oWji3vPuUK7Qw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kees Cook , "David S . Miller" , Sasha Levin Subject: [PATCH 4.14 82/88] r8169: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 28 Jun 2021 10:36:22 -0400 Message-Id: <20210628143628.33342-83-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook [ Upstream commit da5ac772cfe2a03058b0accfac03fad60c46c24d ] 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 checking. Signed-off-by: Kees Cook Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/realtek/r8169.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 530b8da11960..191531a03415 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -2355,7 +2355,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) { switch(stringset) { case ETH_SS_STATS: - memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings)); + memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings)); break; } } -- 2.30.2