From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9467C4743C for ; Mon, 21 Jun 2021 18:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC98961245 for ; Mon, 21 Jun 2021 18:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232667AbhFUSIz (ORCPT ); Mon, 21 Jun 2021 14:08:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:46172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbhFUSE3 (ORCPT ); Mon, 21 Jun 2021 14:04:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 258616128C; Mon, 21 Jun 2021 17:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624298160; bh=mDeuF3j6VCQAJOgEmmQlgahbvTMLe/sAxHkzDN2Z378=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S3O2AV9icr4EUh58f44cYIV0jfJGXu9IocU7q33+Sd4AXb9h+j74s7N5ChVPpXugv A5kWb6JxZQ57HA77e0ahCUoORe94MNIRqDh/nSC/J6T+nZ+NBSq7YiE0HLBRQBNWqL 0aHIYZYEjMrVYMhV8+El6SvQUj++bdhPmDD3ciCcFlB3WJoh5wi0B4ls2LRJ0AGJfh CtJefYUepYSkI0JMMmRgC5rraUt2dfQUekwYlmkWO6C5tJF2p6RF5GsmOSDidR6nhc ILaFIcy/k8IotVQy53tvbyE15XWKrYH3YFVB9arvx40FG9Lhd/mQV2uABV745LAA01 EMfXdIF0B9WsA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kees Cook , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 10/13] sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 21 Jun 2021 13:55:40 -0400 Message-Id: <20210621175544.736421-10-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210621175544.736421-1-sashal@kernel.org> References: <20210621175544.736421-1-sashal@kernel.org> MIME-Version: 1.0 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