[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c208ed916e587048ba6b69840d08324100d7d325@git.kernel.org>
Date: Tue, 18 Oct 2016 08:30:55 -0700
From: tip-bot for Ivan Hu <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: tglx@...utronix.de, peterz@...radead.org, matt@...eblueprint.co.uk,
linux-kernel@...r.kernel.org, mingo@...nel.org,
ivan.khoronzhuk@...aro.org, hpa@...or.com,
torvalds@...ux-foundation.org, ivan.hu@...onical.com,
ard.biesheuvel@...aro.org
Subject: [tip:efi/core] efi/efi_test: Use memdup_user() as a cleanup
Commit-ID: c208ed916e587048ba6b69840d08324100d7d325
Gitweb: http://git.kernel.org/tip/c208ed916e587048ba6b69840d08324100d7d325
Author: Ivan Hu <ivan.hu@...onical.com>
AuthorDate: Tue, 18 Oct 2016 15:33:16 +0100
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 18 Oct 2016 17:11:19 +0200
efi/efi_test: Use memdup_user() as a cleanup
Fix coccicheck warning which recommends to use memdup_user().
This patch fixes the following coccicheck warnings:
drivers/firmware/efi/test/efi_test.c:269:8-15: WARNING opportunity for memdup_user
Signed-off-by: Ivan Hu <ivan.hu@...onical.com>
Signed-off-by: Matt Fleming <matt@...eblueprint.co.uk>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-efi@...r.kernel.org
Link: http://lkml.kernel.org/r/20161018143318.15673-7-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
drivers/firmware/efi/test/efi_test.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index bb26e12..8cd578f 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -265,14 +265,10 @@ static long efi_runtime_set_variable(unsigned long arg)
return rv;
}
- data = kmalloc(setvariable.data_size, GFP_KERNEL);
- if (!data) {
+ data = memdup_user(setvariable.data, setvariable.data_size);
+ if (IS_ERR(data)) {
kfree(name);
- return -ENOMEM;
- }
- if (copy_from_user(data, setvariable.data, setvariable.data_size)) {
- rv = -EFAULT;
- goto out;
+ return PTR_ERR(data);
}
status = efi.set_variable(name, &vendor_guid,
Powered by blists - more mailing lists