aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2021-08-25 09:07:49 -0700
committerHans de Goede <[email protected]>2021-08-26 15:53:38 +0200
commitfb49d9946f96081f9a05d8f305b3f40285afe4a9 (patch)
treea9b4cd23f266f977c1cd71a9e6af3e23377034e7
parent55879dc4d095232609fe81498c1b43f042708eef (diff)
platform/x86: dell-smbios-wmi: Avoid false-positive memcpy() warning
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 <[email protected]> Cc: Mark Gross <[email protected]> Cc: Mario Limonciello <[email protected]> Cc: "Pali Rohár" <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: "Uwe Kleine-König" <[email protected]> Cc: [email protected] Cc: [email protected] Reported-by: Andy Lavr <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
-rw-r--r--drivers/platform/x86/dell/dell-smbios-wmi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
index 33f823772733..01ea4bb958af 100644
--- a/drivers/platform/x86/dell/dell-smbios-wmi.c
+++ b/drivers/platform/x86/dell/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]);