From 8513e84f6ff078f6c25e244bb984c31a24ae2fcc Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Mon, 11 Feb 2019 13:15:45 -0800 Subject: [PATCH] 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 --- core/pld/src/pld_snoc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/pld/src/pld_snoc.c b/core/pld/src/pld_snoc.c index 550554c166f0..3eefd0d9ba2d 100644 --- a/core/pld/src/pld_snoc.c +++ b/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;