Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935451AbdCXSOu (ORCPT ); Fri, 24 Mar 2017 14:14:50 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:37911 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755057AbdCXSOe (ORCPT ); Fri, 24 Mar 2017 14:14:34 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Ard Biesheuvel Date: Fri, 24 Mar 2017 18:14:31 +0000 Message-ID: Subject: Re: [PATCH v2 1/7] efi/capsule: Fix return code on failing kmap/vmap To: Jan Kiszka Cc: Matt Fleming , "linux-efi@vger.kernel.org" , Linux Kernel Mailing List , Andy Shevchenko , "Bryan O'Donoghue" , Hock Leong Kweh , Borislav Petkov , Sascha Weisenberger Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1421 Lines: 37 On 24 March 2017 at 17:34, Jan Kiszka wrote: > 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 Reviewed-by: Ard Biesheuvel > --- > 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 >