Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3863527pxv; Mon, 28 Jun 2021 15:03:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc0B//xsZInGHWPAr4yXjUvRoV5kPgBdQ20nJtto735Q6ooBlbbDQnXxQiKeWTJN51zw1V X-Received: by 2002:aa7:dcd9:: with SMTP id w25mr35253484edu.372.1624917837276; Mon, 28 Jun 2021 15:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624917837; cv=none; d=google.com; s=arc-20160816; b=S8gys1Vw/95L4GRWHeFGx+hRb7PiJ0+gXT652xHQrLxuankRgoLdTiUTSZz5C6wI6c 7EIuhbr+13QCCKidSax3qQDztow14CsdIpM2i1wVyAIpoNZQImq5XsLB6lvRaEOsOSKz jWvo2vVs6Z0CYFh6eUYnal/VtLgLXgQavRoFWv99XVQpvPEtR14PXkYp7zBsU8MBFZBk /3N6R89eXmkmOQblYdf/IwEksbwDw35U7bLOk+Ow1GZ5mumIZdxcAy9GjvIxgjsiZSW7 8Triu9TekMJ2UfK8UOm6/QME7fnDB4VHC1iMTxkcw2AvcR4rRQahKGBaAxpgsMcW2KWU Z8Tw== 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=7LoJx9h+dD4ZijbFWZoMwYGBS7P/t0RzsBqlNwuI5Gs=; b=RBPEBKHE8y88CjrgcI21CJyCqPlVdC7DSWt83GY3PLaGgHCkHVxLinOY011ZIDodUK WJsSAdAXsBU76cM4vmNI4Xfo88FI8FQcGjV8mhNeuh3rHx+NXblhSeYzxHsGSBGL0TL7 0S1PgbjeTa7Khny/9Jv0SrQMnmmc0yDfwtTJaaX76nD4fX5MHSmKhVQLu6jlcFCa3rMs O6W6+5XU3GqRtVVCPp8F683Xsu6AVJclYKgG5C7IQeCoHou6Cx4HIidynvW2z9Z1o0R6 EczAVaEDEEI5QYa+dxlyZ14TvXspjf/o2D7WlojgYxhwQGBq2SPrzVBh2u6vRtMX4TnX Dy8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ETBrnPYg; 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 ka15si15548849ejc.148.2021.06.28.15.03.32; Mon, 28 Jun 2021 15:03:57 -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=ETBrnPYg; 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 S235828AbhF1PZR (ORCPT + 99 others); Mon, 28 Jun 2021 11:25:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:37102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236062AbhF1PCM (ORCPT ); Mon, 28 Jun 2021 11:02:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 724A661D6D; Mon, 28 Jun 2021 14:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891261; bh=d0rFUGv2OW/1L4HfxFYIgaqp8z7UuTp8MhH/e3F0Ww4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ETBrnPYgWP7Ysx8JewwNMG/2tZBmLPCMDhmR1AaCVBRmJtopP0SCOJplbtm2m+Ye6 JGganYgsnxcpY9J8eAanEcyS78vZlNVaGZyfqiX+cO3ZatMuouEUsxSQOf67AIvnDn 3Z8UDbONmjy2+HUCDYSZXGyVTkQ/9BT9QMjz0VQ9amTMThXYIABYyHDYGTwz1SAtBj FyuDX/VY1+n4N8JZyBb3aLjn1M7SM2gSEqVbD0zSEh3wOcUTfrlnbQb7nnBpt1p0UU 22QUhh2fVUJwfDTFEJec6/3XAI3VNnKOeXDj/pB6SRMoScIu16s1f8D+EXOCtoustF uA9vENqY5QFMA== 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 66/71] r8169: Avoid memcpy() over-reading of ETH_SS_STATS Date: Mon, 28 Jun 2021 10:39:58 -0400 Message-Id: <20210628144003.34260-67-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 da5ac772cfe2a03058b0accfac03fad60c46c24d ] 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/realtek/r8169.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 3521e3a77556..f321b115719a 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -2338,7 +2338,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) { switch(stringset) { case ETH_SS_STATS: - memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings)); + memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings)); break; } } -- 2.30.2