qbt_handler: Memset userspace struct to zero

Explicitly memset struct to zero before sending
to userspace. This is to prevent padded bytes
from possibly leaking kernel memory contents to
userspace.

Change-Id: Id3e873164430c34195344884b2899e61aa060dfc
Signed-off-by: Abir Ghosh <abirg@codeaurora.org>
This commit is contained in:
Abir Ghosh 2020-10-28 12:03:09 +05:30
parent 0086d774a8
commit e79ade5989

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#define DEBUG
@ -371,6 +371,8 @@ static long qbt_ioctl(
{
struct qbt_wuhb_connected_status wuhb_connected_status;
memset(&wuhb_connected_status, 0,
sizeof(wuhb_connected_status));
wuhb_connected_status.is_wuhb_connected =
drvdata->is_wuhb_connected;
rc = copy_to_user((void __user *)priv_arg,