Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1013910pxb; Thu, 9 Sep 2021 18:01:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGVjqT/hCRKcDD0qTRXXzbD5UYV+Qcoo/bxgvqTo61wTaxzSIkrfQHiK8G4uBHhCDBEPM/ X-Received: by 2002:a92:b07:: with SMTP id b7mr4460704ilf.82.1631235696287; Thu, 09 Sep 2021 18:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631235696; cv=none; d=google.com; s=arc-20160816; b=LlvGSIm3KS5ANoCaDNjAJxh/7noSHZFXOEgVMH8CwUM3Xxe7MrPKL39v0P/LSUCh1Y E43Zeh/96n3AkWXZICgiwX3MaC9IOQ4lMMyYWKpBti35Lx8vlggAqbtEwo9eMcR4W++C AOPCbTPd9XcISIzMz+grljVcGCQBomCfVuG9B6xwMr8dCD3FyVrpedGUdu4whKoHrWqY gnHY2P3eMpWRWmlWMIQvIBFkTCbbofhj6SWpIfFGboc58/mp46HyweTDcaQR3TM8NdBl +alke+NaQEgA79BMqs9oderuh7WhUurP15MnenEj30PhlTWflT8OL9uVYaSg15Umgiev QEyg== 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=a3sh4mqKyAdD1Cdt7xBrJoUCDxoxcU+2VASTdwZrUqo=; b=P8srdSXfsgc7a4QdySSI/BoC1lpzqt+M9PtA5WT8lztSGNRJ3fc2ni+iBqoFb2Xg0N tVKjxP+L7Vdkt+81SBQvgWas9+EznhbZ08wnZ8kNK1KxcfEk3M8cztIAK5RLXuZLCHWy IvTQ9XDFbEvMal8OUGJ5wOoF4VpQPEoh7r/6KwoG8vBvLiI4flowyfVht0pV6ebX6ydE iT10jZVLD6Bsfe1BH82vuEzPPOzdxiofwgQFNTP68il1R8pNsVPrT9LKz60AhyjYGOB/ 5G0IV+54tVNUVq40ctBffbuxWW+qhQkKN0DLsYUG/UwJ+PhUaUBw6wGiA5M5Sek5Hxft KHVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qQjCprsu; 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 y6si3024331ion.66.2021.09.09.18.01.24; Thu, 09 Sep 2021 18:01:36 -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=qQjCprsu; 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 S234981AbhIJBBB (ORCPT + 99 others); Thu, 9 Sep 2021 21:01:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:48982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234518AbhIJAXd (ORCPT ); Thu, 9 Sep 2021 20:23:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 625A4604DC; Fri, 10 Sep 2021 00:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631233343; bh=OOlkE/5wn5cX1UCFaQILnONAsv24eb8TbOKobIjrxkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQjCprsuPxDCFN0vl2ji1PSmwPWqJB/DXIQTLMD8tE1nTsVZ9YX6wKMUAAMoz62TA ltgPNoDe72oIt2k3nYqPn2T8UwtIxwvlBH2rpfFuI4BeLFelVyQKVSkbRslmbuTH6Y XV8j1dqnfQSWFtM2E4TQDpHSERU1cqJTmf0BBPY2/JvHefbvu0OHM9pkIQFjgQDRzF JmI8sMyTCLvEzgjN7szCDSDDFT3W4BLS3hdIGChtgJIxudRrqExl4JcDRZoiVKnVWs RaVut8J/UE+FcijWnqfAPtllSV+aAJoQ6R/FU6Rd0WIguh4LhOLYexFq2SrDMTYc6J jj+FBKm7cIu1w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kees Cook , Hans de Goede , Mark Gross , Mario Limonciello , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Andy Shevchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org, Andy Lavr , Sasha Levin Subject: [PATCH AUTOSEL 5.4 30/37] platform/x86: dell-smbios-wmi: Avoid false-positive memcpy() warning Date: Thu, 9 Sep 2021 20:21:35 -0400 Message-Id: <20210910002143.175731-30-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210910002143.175731-1-sashal@kernel.org> References: <20210910002143.175731-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 fb49d9946f96081f9a05d8f305b3f40285afe4a9 ] In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Since all the size checking has already happened, use input.pointer (void *) so memcpy() doesn't get confused about how much is being written. Avoids this false-positive warning when run-time memcpy() strict bounds checking is enabled: memcpy: detected field-spanning write (size 4096) of single field (size 36) WARNING: CPU: 0 PID: 357 at drivers/platform/x86/dell/dell-smbios-wmi.c:74 run_smbios_call+0x110/0x1e0 [dell_smbios] Cc: Hans de Goede Cc: Mark Gross Cc: Mario Limonciello Cc: "Pali Rohár" Cc: Andy Shevchenko Cc: "Uwe Kleine-König" Cc: Dell.Client.Kernel@dell.com Cc: platform-driver-x86@vger.kernel.org Reported-by: Andy Lavr Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20210825160749.3891090-1-keescook@chromium.org Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/dell-smbios-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c index c97bd4a45242..32e8c4715d53 100644 --- a/drivers/platform/x86/dell-smbios-wmi.c +++ b/drivers/platform/x86/dell-smbios-wmi.c @@ -71,7 +71,7 @@ static int run_smbios_call(struct wmi_device *wdev) obj->integer.value); return -EIO; } - memcpy(&priv->buf->std, obj->buffer.pointer, obj->buffer.length); + memcpy(input.pointer, obj->buffer.pointer, obj->buffer.length); dev_dbg(&wdev->dev, "result: [%08x,%08x,%08x,%08x]\n", priv->buf->std.output[0], priv->buf->std.output[1], priv->buf->std.output[2], priv->buf->std.output[3]); -- 2.30.2