From 97b23455ccd53a632585d0fd06ff9d30877c810a Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 6 Jul 2018 11:37:56 +0300 Subject: [PATCH] Staging: Gasket: uninitialized return in gasket_mmap() We forgot to set the error code on this error path so ret can be uninitialized. Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver") Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gasket/gasket_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c index 82b3eca7774e..ad9442a5bb9d 100644 --- a/drivers/staging/gasket/gasket_core.c +++ b/drivers/staging/gasket/gasket_core.c @@ -1719,8 +1719,10 @@ static int gasket_mmap(struct file *filp, struct vm_area_struct *vma) /* Try the next region if this one was not mappable. */ if (map_status == DO_MAP_REGION_INVALID) continue; - if (map_status == DO_MAP_REGION_FAILURE) + if (map_status == DO_MAP_REGION_FAILURE) { + ret = -ENOMEM; goto fail; + } has_mapped_anything = 1; } -- 2.30.2