Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3863249pxv; Mon, 28 Jun 2021 15:03:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkID/AyCrYovSwMZGAwarkVuW/VGwaWJpLVGU2qJOegZMBjjDlUJEKD3aNcgJFUANEEEZz X-Received: by 2002:a05:6402:1014:: with SMTP id c20mr12176102edu.380.1624917812270; Mon, 28 Jun 2021 15:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624917812; cv=none; d=google.com; s=arc-20160816; b=uxKUI9kZmEmId53JyFyeNED5gUQvcGm8DrzGWLEAx1TagbUV65soPvhTZtYmXf8wpr zjH2qDd/tkvDfjN4sn8G9aBg1QLaJn0BBc3G2ChfIrlkF09vDwaT6vSg/EkYIRck8HAj /hvQl3wN21EN4p0E3uIFeSEIbC0+zTYazRDrterSbDo8GTFXXmi7o42nMo0SfQ/8K9GO dG3RQuwZQDi6DmVKcTIXGAHDnRFv6uPmq2Iw9LVxGk3g319OPozv1KDMWgJKqm+j0M6O wrXJL5mjR79mL8L/bGa2c8YLU+Sd7HRshMK4DM01Kg9AZX84DaprsoGBnNXJUY8TJSVW ditg== 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=oykk1ZTKuArD9XHvSXMTSq2OW3J5SpdQNLFdaPMFE7k=; b=iCkyQCDwH6RIUoUJH4cAt6tmi4XdI+yh1f2tSdEvYbTp/LjHdql1coUK1dzPpQ91eQ uAhLEIwGPHsJNzaadbPZEU4DVVMxzWloOY2U6qUjghnD12+9Hn/5mk9gS21DwO7mbB1u DGuRNEOC/jprBMggQ30I98dud8WfMtHqDFkDkOC7XF3jG/WE12kSAnPlg+675mnwpd5a ghU3NFJ5j8XLllU0jlbMN0K6rpAudy9Igx3hR0uRovfOXgpscIZC9vx30gw02e16kG33 nwpfTMvXs3jvIIHyhE6Jz80K3x9CzuXvnpkNaxVZrEGklwtrUIx+/DNbRvD0yRVIPwPb a6kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lw106rnc; 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 4si15216773ejr.126.2021.06.28.15.03.08; Mon, 28 Jun 2021 15:03:32 -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=Lw106rnc; 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 S234746AbhF1PYw (ORCPT + 99 others); Mon, 28 Jun 2021 11:24:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:37040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236587AbhF1PCB (ORCPT ); Mon, 28 Jun 2021 11:02:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC4A061CCD; Mon, 28 Jun 2021 14:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891261; bh=mDeuF3j6VCQAJOgEmmQlgahbvTMLe/sAxHkzDN2Z378=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lw106rncu//e3paaaQPDKhBpPrVHVYFvEUGDWw2SxaomZ6X8zEP6ecBjjMz4Irz52 0rTysqzO6HgVaHaWgc9JLZ0gx3QhMIs5kngwy0YAKT4BhlQkHmYKnGoRgoROnR1Wjx hWN8F07QxndEiqqtmt+mTtwGvCQIacEuRV1e3dvGtacsbzfmYygP7TXkwh2ANJXT2O 95dyDyCp9MtVmTIcqzDgyHiqBpDJNZepkPvAXjcPAOKhlstpirXwOzwW6A/lCX5pNH kp/ZKmX60bG9RFznzcVAJTfWJZbsTAFhTHsxqcd1xEJZqEvk+niS8ktKX7r3xvOiVX 9d/ybbArtVaug== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kees Cook , "David S . Miller" , Sasha Levin Subject: [PATCH 4.9 65/71] sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 28 Jun 2021 10:39:57 -0400 Message-Id: <20210628144003.34260-66-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628144003.34260-1-sashal@kernel.org> References: <20210628144003.34260-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.274-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.9.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.9.274-rc1 X-KernelTest-Deadline: 2021-06-30T14:39+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 0e5b1935af50..468f02beccee 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2117,7 +2117,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