Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3837328pxv; Mon, 28 Jun 2021 14:17:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUjVlgnzEr3FtiCWy4D5C5KPmJwxL0D0oi3CSJ3i45LsvtEb7HdtpvEA4TAtlNi5YhSpZJ X-Received: by 2002:a5e:aa07:: with SMTP id s7mr1137138ioe.186.1624915028094; 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=zIu/U2aCxRlVM/7Tda5bfxJiJOb/pFBVv5viJtyrBNzTXhrtpI6X7qI0tnNzyJ/VtW kWFb6hJEegSp/NyhSj2NPEm+f/31Q+qCHALAvJlR8eBtVfFsZW2NOulLbVbg3DZf+uzT kO8xv1lmRwvrCL3hw/s2LbsMHY0uA4SVatQupTAOHTzxp0zMc3R6E28NESjxdK2S/G0F 7pMn3xTNuakKZ+BIm1r7NimXgDmOxK5U/DDJydi5iuDTIGhImhJz+DjIo9959vml0bFH Ues2E+GeP96RxhvZ0aFZLyKImLz3HvLdM7dePSkRAcupmCOUkeJ1HMKZgLqsLs5ZVUsH jpnA== 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=nzasUk2bs9OxyPJldo7sPQrlNtjjsUSgJsrEhcyL30o=; b=EOtF5CmiK+9BYwGT8FIIPO5pG0QjaeAgJtnEBTxaGLBkog1QCz8mJW/W31nURbTwRF otIgqGYHH8efIaPRqqF6Tl/V3fgMRa+8S9kG9NWKr9cjqXDylwrQIZIlhtghDbqwPhnA su2LJxttu7M7BVd65fYFsOpYm/hkAmHapfizwj85P2Q2TaDZ9Ys/gaYOPniJwOaIdRo1 OwVwtTmfgXyY0YXIlzDAYlY/ID0/RrZ+anNo5186Y41YtH5vn7j6yFgd7tn2I9iiAjyB oGaZublRQ4Ok78FlVMhqClOq6gfI8AKanhwA6loK51+JVEu9tATxTo1wYt7C82MD4Kff 8FAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GkTx/XUc"; 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 d198si18539513jac.70.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="GkTx/XUc"; 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 S235919AbhF1PQY (ORCPT + 99 others); Mon, 28 Jun 2021 11:16:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:59556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236199AbhF1Oy5 (ORCPT ); Mon, 28 Jun 2021 10:54:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8CC6361CBC; Mon, 28 Jun 2021 14:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891059; bh=Y8LH12gw3ai5GFatjMPXNOpi11MLQkzPyNHpM21pDus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GkTx/XUcxWv2OrIkajnLsSah+wg44qszPPWRzT4w/rlV2k3oMciRkd0hEG8oGs/WR mUBXnmixBDdk3JwbqgN640XS9HFpXRPVwDRRFAhPkflwVd2RXsQ2kFCWPggZHb0pll ANGzaL6higb8U1TJY3wo3uMGCq/LEGX1IChBgTDdfwnM9R4qRc58NVevj0kQnflKdz Dy3Pr3LYaxH9zh6Pk9rlUpF1tFNGszQP9ZkSMO9SAzQIWiebusdb915WT42sG0r3Kc 4EqiTiHx5V385PS4qaC+3i9AHtHdtqqxm76F7x8kuOVUFwBIiAcJmLRqQNFT4rSfY7 19QLlJwFCbTpg== 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 80/88] r8152: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 28 Jun 2021 10:36:20 -0400 Message-Id: <20210628143628.33342-81-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 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 f9c531a6ce06..8da3c891c9e8 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -4640,7 +4640,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