Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751796AbdCXRen (ORCPT ); Fri, 24 Mar 2017 13:34:43 -0400 Received: from david.siemens.de ([192.35.17.14]:60966 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbdCXRed (ORCPT ); Fri, 24 Mar 2017 13:34:33 -0400 From: Jan Kiszka To: Matt Fleming , Ard Biesheuvel Cc: linux-efi@vger.kernel.org, Linux Kernel Mailing List , Andy Shevchenko , "Bryan O'Donoghue" , Hock Leong Kweh , Borislav Petkov , Sascha Weisenberger Subject: [PATCH v2 1/7] efi/capsule: Fix return code on failing kmap/vmap Date: Fri, 24 Mar 2017 18:34:14 +0100 Message-Id: X-Mailer: git-send-email 2.10.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1079 Lines: 32 If kmap or vmap fail, it means we ran out of memory. There are no user-provided addressed involved that would justify EFAULT. Signed-off-by: Jan Kiszka --- drivers/firmware/efi/capsule-loader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c index 9ae6c11..91e91f7 100644 --- a/drivers/firmware/efi/capsule-loader.c +++ b/drivers/firmware/efi/capsule-loader.c @@ -113,7 +113,7 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info) VM_MAP, PAGE_KERNEL); if (!cap_hdr_temp) { pr_debug("%s: vmap() failed\n", __func__); - return -EFAULT; + return -ENOMEM; } ret = efi_capsule_update(cap_hdr_temp, cap_info->pages); @@ -185,7 +185,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff, kbuff = kmap(page); if (!kbuff) { pr_debug("%s: kmap() failed\n", __func__); - ret = -EFAULT; + ret = -ENOMEM; goto failed; } kbuff += PAGE_SIZE - cap_info->page_bytes_remain; -- 2.10.2