From: Maximilian Luz Date: Mon, 11 Jan 2021 15:48:50 +0000 (+0100) Subject: platform/surface: aggregator_cdev: Fix access of uninitialized variables X-Git-Tag: accepted/tizen/unified/20230118.172025~7824^2~75 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a403c1dfcf9fb73a4a362f14ca1c1f04662c49e0;p=platform%2Fkernel%2Flinux-rpi.git platform/surface: aggregator_cdev: Fix access of uninitialized variables When copy_struct_from_user() in ssam_cdev_request() fails, we directly jump to the 'out' label. In this case, however 'spec' and 'rsp' are not initialized, but we still access fields of those variables. Fix this by initializing them at the time of their declaration. Reported-by: Colin Ian King Fixes: 178f6ab77e61 ("platform/surface: Add Surface Aggregator user-space interface") Addresses-Coverity: ("Uninitialized pointer read") Signed-off-by: Maximilian Luz Link: https://lore.kernel.org/r/20210111154851.325404-2-luzmaximilian@gmail.com Signed-off-by: Hans de Goede --- diff --git a/drivers/platform/surface/surface_aggregator_cdev.c b/drivers/platform/surface/surface_aggregator_cdev.c index 340d15b..979340c 100644 --- a/drivers/platform/surface/surface_aggregator_cdev.c +++ b/drivers/platform/surface/surface_aggregator_cdev.c @@ -66,8 +66,8 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg) { struct ssam_cdev_request __user *r; struct ssam_cdev_request rqst; - struct ssam_request spec; - struct ssam_response rsp; + struct ssam_request spec = {}; + struct ssam_response rsp = {}; const void __user *plddata; void __user *rspdata; int status = 0, ret = 0, tmp;