Browse Source

rmnet_core: memset before sending genl response

Ensure that the generic netlink response has a memset payload
before sending to userspace

Change-Id: Ie2fa92ce80bb3c0716e779cebeaedb2d31d759c1
Acked-by: Ryan Chapman <[email protected]>
Signed-off-by: Subash Abhinov Kasiviswanathan <[email protected]>
Signed-off-by: Kaustubh Pandey <[email protected]>
Subash Abhinov Kasiviswanathan 4 years ago
parent
commit
e20c17876f
1 changed files with 3 additions and 3 deletions
  1. 3 3
      core/rmnet_genl.c

+ 3 - 3
core/rmnet_genl.c

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
  *
  * RMNET Data Generic Netlink
  *
@@ -322,9 +322,9 @@ int rmnet_core_genl_pid_bps_req_hdlr(struct sk_buff *skb_2,
 		rmnet_core_userspace_connected = 1;
 
 	/* Copy to pid/byte list to the payload */
+	memset(&pid_bps_resp, 0x0,
+	       sizeof(pid_bps_resp));
 	if (is_req_valid) {
-		memset(&pid_bps_resp, 0x0,
-		       sizeof(pid_bps_resp));
 		rmnet_create_pid_bps_resp(&pid_bps_resp);
 	}
 	pid_bps_resp.valid = 1;