From: Colin Ian King Date: Wed, 17 May 2017 18:24:15 +0000 (+0100) Subject: CIFS: check if pages is null rather than bv for a failed allocation X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~7619^2~3 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ecf3411a121e7a653e309ff50a820ffa87c537f8;p=mirror_ubuntu-focal-kernel.git CIFS: check if pages is null rather than bv for a failed allocation pages is being allocated however a null check on bv is being used to see if the allocation failed. Fix this by checking if pages is null. Detected by CoverityScan, CID#1432974 ("Logically dead code") Fixes: ccf7f4088af2dd ("CIFS: Add asynchronous context to support kernel AIO") Signed-off-by: Colin Ian King Reviewed-by: Pavel Shilovsky Signed-off-by: Steve French --- diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index b08531977daa..3b147dc6af63 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -810,7 +810,7 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) if (!pages) { pages = vmalloc(max_pages * sizeof(struct page *)); - if (!bv) { + if (!pages) { kvfree(bv); return -ENOMEM; }