From: tip-bot for Geliang Tang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: geliangtang@gmail.com, tglx@linutronix.de,
ard.biesheuvel@linaro.org, linux-kernel@vger.kernel.org,
mingo@kernel.org, ivan.hu@canonical.com, peterz@infradead.org,
matt@codeblueprint.co.uk, hpa@zytor.com,
torvalds@linux-foundation.org
Subject: [tip:efi/core] efi/efi_test: Use memdup_user() helper
Date: Mon, 5 Jun 2017 10:15:29 -0700 [thread overview]
Message-ID: <tip-5f72cad65cfaac5e40d0de8b7f48ee647af69cd5@git.kernel.org> (raw)
In-Reply-To: <20170602135207.21708-12-ard.biesheuvel@linaro.org>
Commit-ID: 5f72cad65cfaac5e40d0de8b7f48ee647af69cd5
Gitweb: http://git.kernel.org/tip/5f72cad65cfaac5e40d0de8b7f48ee647af69cd5
Author: Geliang Tang <geliangtang@gmail.com>
AuthorDate: Fri, 2 Jun 2017 13:52:05 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:42 +0200
efi/efi_test: Use memdup_user() helper
Use memdup_user() helper instead of open-coding to simplify the code.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Ivan Hu <ivan.hu@canonical.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-12-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/firmware/efi/test/efi_test.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index 8cd578f..08129b7 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -71,18 +71,13 @@ copy_ucs2_from_user_len(efi_char16_t **dst, efi_char16_t __user *src,
if (!access_ok(VERIFY_READ, src, 1))
return -EFAULT;
- buf = kmalloc(len, GFP_KERNEL);
- if (!buf) {
+ buf = memdup_user(src, len);
+ if (IS_ERR(buf)) {
*dst = NULL;
- return -ENOMEM;
+ return PTR_ERR(buf);
}
*dst = buf;
- if (copy_from_user(*dst, src, len)) {
- kfree(buf);
- return -EFAULT;
- }
-
return 0;
}
next prev parent reply other threads:[~2017-06-05 17:21 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 13:51 [GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel
2017-06-02 13:51 ` [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore Ard Biesheuvel
2017-06-05 15:40 ` Ingo Molnar
2017-06-05 16:03 ` Ard Biesheuvel
2017-06-05 16:14 ` Andy Lutomirski
2017-06-02 13:51 ` [PATCH 02/13] efi/capsule: Fix return code on failing kmap/vmap Ard Biesheuvel
2017-06-05 17:10 ` [tip:efi/core] " tip-bot for Jan Kiszka
2017-06-02 13:51 ` [PATCH 03/13] efi/capsule: Remove pr_debug on ENOMEM or EFAULT Ard Biesheuvel
2017-06-05 17:10 ` [tip:efi/core] efi/capsule: Remove pr_debug() " tip-bot for Jan Kiszka
2017-06-02 13:51 ` [PATCH 04/13] efi/capsule: Clean up pr_err/info messages Ard Biesheuvel
2017-06-05 17:11 ` [tip:efi/core] efi/capsule: Clean up pr_err/_info() messages tip-bot for Jan Kiszka
2017-06-02 13:51 ` [PATCH 05/13] efi/capsule: Adjust return type of efi_capsule_setup_info Ard Biesheuvel
2017-06-05 17:12 ` [tip:efi/core] efi/capsule: Adjust return type of efi_capsule_setup_info() tip-bot for Jan Kiszka
2017-06-02 13:52 ` [PATCH 06/13] efi/capsule-loader: Use a cached copy of the capsule header Ard Biesheuvel
2017-06-05 17:12 ` [tip:efi/core] " tip-bot for Ard Biesheuvel
2017-06-02 13:52 ` [PATCH 07/13] efi/capsule: Remove NULL test on kmap() Ard Biesheuvel
2017-06-05 17:13 ` [tip:efi/core] " tip-bot for Fabian Frederick
2017-06-02 13:52 ` [PATCH 08/13] efi/capsule-loader: Redirect calls to efi_capsule_setup_info via weak alias Ard Biesheuvel
2017-06-05 17:13 ` [tip:efi/core] efi/capsule-loader: Redirect calls to efi_capsule_setup_info() " tip-bot for Ard Biesheuvel
2017-06-02 13:52 ` [PATCH 09/13] efi/capsule-loader: Use page addresses rather than struct page pointers Ard Biesheuvel
2017-06-05 17:14 ` [tip:efi/core] " tip-bot for Ard Biesheuvel
2017-06-02 13:52 ` [PATCH 10/13] efi/capsule: Add support for Quark security header Ard Biesheuvel
2017-06-05 15:50 ` Ingo Molnar
2017-06-05 16:00 ` Ard Biesheuvel
2017-06-05 16:11 ` Ingo Molnar
2017-06-05 17:14 ` [tip:efi/core] " tip-bot for Jan Kiszka
2017-06-02 13:52 ` [PATCH 11/13] efi/efi_test: Use memdup_user() helper Ard Biesheuvel
2017-06-05 17:15 ` tip-bot for Geliang Tang [this message]
2017-06-02 13:52 ` [PATCH 12/13] x86/efi: Add EFI_PGT_DUMP support for x86_32 and kexec Ard Biesheuvel
2017-06-05 17:16 ` [tip:efi/core] x86/efi: Extend CONFIG_EFI_PGT_DUMP support to x86_32 and kexec as well tip-bot for Sai Praneeth
2017-06-02 13:52 ` [PATCH 13/13] efi: arm: enable DMI/SMBIOS Ard Biesheuvel
2017-06-05 17:16 ` [tip:efi/core] efi/arm: Enable DMI/SMBIOS tip-bot for Ard Biesheuvel
2017-06-05 8:15 ` [GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel
2017-06-05 9:07 ` Ingo Molnar
2017-06-05 9:35 ` Ard Biesheuvel
2017-06-05 15:53 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-5f72cad65cfaac5e40d0de8b7f48ee647af69cd5@git.kernel.org \
--to=tipbot@zytor.com \
--cc=ard.biesheuvel@linaro.org \
--cc=geliangtang@gmail.com \
--cc=hpa@zytor.com \
--cc=ivan.hu@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox