[PATCH 2/2] efi_runtime: Don't use get_user() on non-pointer

Matt Fleming matt at console-pimps.org
Tue Oct 21 11:50:26 UTC 2014


From: Matt Fleming <matt.fleming at intel.com>

We don't need to try to construct a pointer from a structure on the
stack in order to use get_user(). We can just access it directly.

This fixes an efi_runtime_set_waketime() failure, introduced with commit
"efi_runtime: Copied the structure from userland locally in kernel
space".

Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
 efi_runtime/efi_runtime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
index 59609bc956b2..40fb9607f504 100644
--- a/efi_runtime/efi_runtime.c
+++ b/efi_runtime/efi_runtime.c
@@ -394,8 +394,8 @@ static long efi_runtime_set_waketime(unsigned long arg)
 	if (copy_from_user(&psetwakeuptime_local, psetwakeuptime, sizeof(psetwakeuptime_local)))
 		return -EFAULT;
 
-	if (get_user(enabled, &(psetwakeuptime_local.Enabled)) ||
-				copy_from_user(&efi_time, psetwakeuptime_local.Time, sizeof(EFI_TIME)))
+	enabled = psetwakeuptime_local.Enabled;
+	if (copy_from_user(&efi_time, psetwakeuptime_local.Time, sizeof(EFI_TIME)))
 		return -EFAULT;
 
 	convert_to_efi_time(&eft, &efi_time);
-- 
1.9.3




More information about the fwts-devel mailing list