From patchwork Tue Oct 21 11:50:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 401451 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id D296A14001A; Tue, 21 Oct 2014 22:50:46 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XgXxd-0007P9-Ob; Tue, 21 Oct 2014 11:50:45 +0000 Received: from mail-wi0-f178.google.com ([209.85.212.178]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XgXxT-0007O8-My for fwts-devel@lists.ubuntu.com; Tue, 21 Oct 2014 11:50:35 +0000 Received: by mail-wi0-f178.google.com with SMTP id r20so1570496wiv.17 for ; Tue, 21 Oct 2014 04:50:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9wVrPXNQFuC02VfbH1I/1o64rjM7WpFGT2oM8kKVPX4=; b=LqtB/NJ6ynPUgLmfdqOuqvWa1TkPzTqDWN4EZciWjGw1iOvb7ezNteLy/wwXpF5zvm RsgctJ1omkbHjM32vOpN26lmz808CmeblZa6EsIJ7IiYPfwalYxYFbmoa5Pknlbxwq8x 5YCutqmEHuL041qTlgzo8Nkiz7i7Nl2fO2yZpCSRmhoQdukrbS63yeOr0rPndTR/kdGR Mff5om6J/vdq8iy/5e2EqgQai430XEHSZ1lEiz1VnUhTij+F/05crw5iooS2UOoYq3bf s1rsOgxCIvRB+s+7yQzHpCwFctMehT6m7bBk2AuTVGkd87S9KtthFpb8J1lwNHLY1p0C e96w== X-Gm-Message-State: ALoCoQnwyi45yn3BsMgJewWkieX4N2HO3dXN6iJ3OmfcbXB1dfv8jl2ZDhWj2QKAPjvwRA6LWNXR X-Received: by 10.180.206.173 with SMTP id lp13mr26845969wic.78.1413892235471; Tue, 21 Oct 2014 04:50:35 -0700 (PDT) Received: from localhost ([94.8.52.96]) by mx.google.com with ESMTPSA id vm6sm15137330wjc.16.2014.10.21.04.50.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Oct 2014 04:50:34 -0700 (PDT) From: Matt Fleming To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] efi_runtime: Don't use get_user() on non-pointer Date: Tue, 21 Oct 2014 12:50:26 +0100 Message-Id: <1413892226-27849-3-git-send-email-matt@console-pimps.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1413892226-27849-1-git-send-email-matt@console-pimps.org> References: <1413892226-27849-1-git-send-email-matt@console-pimps.org> Cc: Matt Fleming , Pradeep Gaddam X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Matt Fleming 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 Acked-by: Alex Hung Acked-by: Ivan Hu --- 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);