efi/capsule: Remove NULL test on kmap()
authorFabian Frederick <[email protected]>
Fri, 2 Jun 2017 13:52:01 +0000 (13:52 +0000)
committerIngo Molnar <[email protected]>
Mon, 5 Jun 2017 15:50:40 +0000 (17:50 +0200)
kmap() can't fail.

Signed-off-by: Fabian Frederick <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Cc: Kweh Hock Leong <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
drivers/firmware/efi/capsule-loader.c
drivers/firmware/efi/capsule.c

index 5b012a467d7d62b0f8f0c87b7fd1b3c020a87f5e..2357bcdcb44d1d6e24517f4dc35e826bf00217c6 100644 (file)
@@ -170,10 +170,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
        page = cap_info->pages[cap_info->index - 1];
 
        kbuff = kmap(page);
-       if (!kbuff) {
-               ret = -ENOMEM;
-               goto failed;
-       }
        kbuff += PAGE_SIZE - cap_info->page_bytes_remain;
 
        /* Copy capsule binary data from user space to kernel space buffer */
index 6eedff45e6d77811a5c4922e6be6fa5cabb3b307..e603ccf39d800a7d6e741c9eac84ab1d1129aa64 100644 (file)
@@ -247,10 +247,6 @@ int efi_capsule_update(efi_capsule_header_t *capsule, struct page **pages)
                efi_capsule_block_desc_t *sglist;
 
                sglist = kmap(sg_pages[i]);
-               if (!sglist) {
-                       rv = -ENOMEM;
-                       goto out;
-               }
 
                for (j = 0; j < SGLIST_PER_PAGE && count > 0; j++) {
                        u64 sz = min_t(u64, imagesize, PAGE_SIZE);