Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3599049pxv; Mon, 28 Jun 2021 08:16:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDVg9IFCkCRa4x9d7tguXnmdOGkOnR/GDL9jRNrBqOk3+o9YF7A7rkvcJYbNVZx2X7KGIs X-Received: by 2002:a6b:490d:: with SMTP id u13mr21450801iob.176.1624893398200; Mon, 28 Jun 2021 08:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624893398; cv=none; d=google.com; s=arc-20160816; b=B9SUUBGqZGov6F/UsPEOTtqifndxVwGWiNvC77WRXWgPo8jd4rvRpCsZyP++GgM2Vz Zj+iZfYgjNqVfJV69eskPGDvL70mVgwnGuFL1eh96wxWBb/Jk5CEi4HPepBqu8do7I0y 6BPml//i0c16rTD9EnwzbCSWVIokzAtxmxAiZRvFN6LCqogL2iAjCYT7u/wWWceswUEA Uge7Tz5Ygr9haOqbmYTR0ADyRGXpkIlgSfypsiVRJk68S5vfm7dwD6jhi+EyhZxV8KM8 UBPcxl4YO192FTqmGoprAYkNiDI1qoabErHuA3a1+/yXmwEvcMb4we9WOO2IWiuz9cTu 3XRA== 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=GoA7eEfi82JuP8d/xh9zPzZYbHZaWSt7vvxdCGVmEGw=; b=I5/M6rRHnTCI0r+EswqjBnaBarhrcTaPQo4A5M2Ez5Vlwu+nyZlPmssmqTyIhkI7dR ABi6GViN5Yz91FDpoTlTs8YxLi41ee6Oo7ZyjgpToKK6WQINw5T0HGTZNgnDi2Yg2CL4 svRI+mstvwzZfihRZV+iuUzL74HrnnE2qGHz0hy4cUKgS2ce7oxTGcRJiFHum0iBbZ9d 3jK0moD7QQ0OWAVHHoMPYlVAXpA0dhHZybDFJsYFqCCwnMxDlCwajF2gk+jSiBtAKY5y 2rncYmqkqUjEWJ0NOVVLG2+IMpIMFbHTzs0YEZr0xLeXKc3hVT+4+WVMfpIBG5kSczWz jS2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UetLDCQr; 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 p11si16522457ioo.38.2021.06.28.08.16.21; Mon, 28 Jun 2021 08:16:38 -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=UetLDCQr; 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 S236179AbhF1PQf (ORCPT + 99 others); Mon, 28 Jun 2021 11:16:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:59580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236197AbhF1Oy5 (ORCPT ); Mon, 28 Jun 2021 10:54:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5127C61CBE; Mon, 28 Jun 2021 14:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891059; bh=Kd9a3ZNmyTVW0IOsoOLCiBjQhKEGktUcBWuBImjJLo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UetLDCQrCkSAM6egiUJI4QzD7gF9kEHiMtKvfzEX61hp0THP4x/1jU7xpEJkuGsGc dSQ6FmMabEi8hx++1F3DLxOenjpvLsNcskpjIdsDkOiABv0CDd1GT6bG/nu6ABb/LH Nd1NXSt5X9gJ58Z3NqyZ49aaU3OayXC/guoNjM9HFhq+b3S9qylikVHC/fFQImzzZU oD8+nnQAdrDTbS5dPccYGD0R1bs5ukJwVInPzgxsNdCCpxXt4LdaI9tqVv9Ous+Oy4 4fCAOT8uPr4RyP7FJoDj2bMZMcA/FOnbik8Whqhhr76mtvr96EWrLV6/AZ0VPPqSPU lsQoYrVcUfZJw== 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 81/88] sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 28 Jun 2021 10:36:21 -0400 Message-Id: <20210628143628.33342-82-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 224004fbb033600715dbd626bceec10bfd9c58bc ] 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/renesas/sh_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index dab1597287b9..36f1019809ea 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2197,7 +2197,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data) { switch (stringset) { case ETH_SS_STATS: - memcpy(data, *sh_eth_gstrings_stats, + memcpy(data, sh_eth_gstrings_stats, sizeof(sh_eth_gstrings_stats)); break; } -- 2.30.2