Browse Source

qcacld-3.0: Zero-initialize soc info

pld_snoc_get_soc_info() stack allocates a icnss_soc_info struct before
populating its contents via a call to icnss_get_soc_info(). However,
icnss_get_soc_info() may not populate all of the fields of the struct.
Zero-initialize the struct before passing it to icnss_get_soc_info() to
avoid using any uninitialized values.

Change-Id: I859a880c9fb8483b66e17ded2857634ab878977a
CRs-Fixed: 2396653
Dustin Brown 6 years ago
parent
commit
8513e84f6f
1 changed files with 5 additions and 5 deletions
  1. 5 5
      core/pld/src/pld_snoc.c

+ 5 - 5
core/pld/src/pld_snoc.c

@@ -381,15 +381,15 @@ int pld_snoc_wlan_disable(struct device *dev, enum pld_driver_mode mode)
  */
 int pld_snoc_get_soc_info(struct device *dev, struct pld_soc_info *info)
 {
-	int ret = 0;
-	struct icnss_soc_info icnss_info;
+	int errno;
+	struct icnss_soc_info icnss_info = {0};
 
 	if (info == NULL || !dev)
 		return -ENODEV;
 
-	ret = icnss_get_soc_info(dev, &icnss_info);
-	if (0 != ret)
-		return ret;
+	errno = icnss_get_soc_info(dev, &icnss_info);
+	if (errno)
+		return errno;
 
 	info->v_addr = icnss_info.v_addr;
 	info->p_addr = icnss_info.p_addr;