From: Maximilian Luz <luzmaximilian@gmail.com>
To: platform-driver-x86@vger.kernel.org
Cc: Maximilian Luz <luzmaximilian@gmail.com>,
Hans de Goede <hdegoede@redhat.com>,
Mark Gross <mgross@linux.intel.com>,
Colin Ian King <colin.king@canonical.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH -next 1/2] platform/surface: aggregator_cdev: Fix access of uninitialized variables
Date: Mon, 11 Jan 2021 16:48:50 +0100 [thread overview]
Message-ID: <20210111154851.325404-2-luzmaximilian@gmail.com> (raw)
In-Reply-To: <20210111154851.325404-1-luzmaximilian@gmail.com>
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 <colin.king@canonical.com>
Fixes: 178f6ab77e61 ("platform/surface: Add Surface Aggregator user-space interface")
Addresses-Coverity: ("Uninitialized pointer read")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
---
drivers/platform/surface/surface_aggregator_cdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/surface/surface_aggregator_cdev.c b/drivers/platform/surface/surface_aggregator_cdev.c
index 340d15b148b9..979340cdd9de 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;
--
2.30.0
next prev parent reply other threads:[~2021-01-11 15:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 15:48 [PATCH -next 0/2] platform/surface: aggregator_cdev: Fixes for CI analysis Maximilian Luz
2021-01-11 15:48 ` Maximilian Luz [this message]
2021-01-11 15:48 ` [PATCH -next 2/2] platform/surface: aggregator_cdev: Add comments regarding unchecked allocation size Maximilian Luz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210111154851.325404-2-luzmaximilian@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=colin.king@canonical.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox