Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3863324pxv; Mon, 28 Jun 2021 15:03:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn3PaRfOMv9VCMjPwvdp1FwnkfOwLxdempbQAi21uJH9gpdoULyr7wKdo9SPkQpU473UDv X-Received: by 2002:a17:906:8495:: with SMTP id m21mr26034513ejx.181.1624917818422; Mon, 28 Jun 2021 15:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624917818; cv=none; d=google.com; s=arc-20160816; b=wcW4p4l+Bolfw0FvAtcNOD/SBmJfewkJEekMKi7CRLbrmZOGujLun8AYQJG7+sPsNe nJnZuEpRVqYR4rcCxScnIR/JzkLhCvy+G7wXpceiWkqrLIeWD1qKi5LX2Evc4oiqc8DS 0ZQDeK+hyGXHYTztj+d689glNYeIVZtqPBzYNgyXOdNuRsRkBvHe457PMlZEtAwsDetx S/IMtL3wSoLSQQVXJAIhBJrYdt6mkUjRjWHGtIvlcmV02azcs+cxJixWk9XNNMA/ngYS D1OVdrRO5/PKtctA46TSzdVPG/StMDJUahZi48gkxvxBdBCwq828Lf4+vD9sPeCCkHSE 97lA== 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=j6qxlLYkqxuK8tGpGNyIvaxH9zyHt8yw+Q/Pv6YJG2k=; b=GuYeXGnelePzzhvWjAVVGgYRpL57cnnOa1j6wXdSDYXQzm6MTODqqghMJC3/IVFi7P jILl4Ll0sJtzuI63QUdUt18l4BMTEI2EQylkJ3bzZN1KsK0VWXTEljoY4FOV2YDBrkmP O0v8VrB7zYaRLc3tQcPECwryVTbLu4x/mHHr/Z3K0LgaISHDw0QWB2RReCUcDNWOeimI adUQY6EPHSh7BNxB2meLH6WFzB64POoofKxARiZkIMMrxVVpGq6u/BFO88wh45I3WPJK idzWeIIdMZO2p+rDpBlXb2fP3jzEpSND+7H4H4Ij4/mJEMcJo0DhMQeknpevWnLDAW2O Lcag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p5Q1G+BC; 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 ca15si14910500edb.416.2021.06.28.15.03.12; Mon, 28 Jun 2021 15:03: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=p5Q1G+BC; 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 S235550AbhF1PY6 (ORCPT + 99 others); Mon, 28 Jun 2021 11:24:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:37050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236591AbhF1PCB (ORCPT ); Mon, 28 Jun 2021 11:02:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8FFF61D77; Mon, 28 Jun 2021 14:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891260; bh=2c4SdLcWZ1rC+EZJHcOg/uwJ+04fRZSNs78cXqgTGHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p5Q1G+BC5srv3pbksHrlx10r2FLhDiSP684xSmxou/DOY5Che/Gr8Cy28Dn0/sH4V 2TgzTi7C6Ov13D/+QasEqisf7ZoWzP/7Gy/wOfIgwlvc+ttQDnLwqMUt2vhM84Zc5E O6A6b51mauykS9NViJZuoN5+kpBGb+oO1n/kY48EayX2Pp1e25ekSt0VZq5iLsnhNZ mC9fQqg5lxVJTrQdFLvzbP+Xr0u0q2FOYvqXTunwdeLGAbjFwxmbxmKfaXSkvY3wbF X5ig9RRKnLB4g5Oc5xekuxWPnY5OL7tNzzgGXvdqGj7x7Wv+BeUBtApc0GpRcMdCrd E53ve99rMLlSw== 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 64/71] r8152: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 28 Jun 2021 10:39:56 -0400 Message-Id: <20210628144003.34260-65-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 99718abdc00e86e4f286dd836408e2834886c16e ] 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/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 6e74965d26a0..64fdea332886 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3938,7 +3938,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) { switch (stringset) { case ETH_SS_STATS: - memcpy(data, *rtl8152_gstrings, sizeof(rtl8152_gstrings)); + memcpy(data, rtl8152_gstrings, sizeof(rtl8152_gstrings)); break; } } -- 2.30.2