]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
wireless: bcmdhd: fix uninitialized scalar variable
authorBhadram Varka <vbhadram@nvidia.com>
Thu, 19 Jan 2017 00:15:13 +0000 (05:45 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 23 Jan 2017 06:34:00 +0000 (22:34 -0800)
Since semaphore variable stored in stack and will vanish
once the function returned. The same will be accessed in
some other context. So making the variable as static will
initialize the variable content with zeros and also retain
the pointer content.

Coverity ID 18092
Bug 200192398

Change-Id: I94517179604b19f54e3f5e5b3b75b92ab89f1d08
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: http://git-master/r/1228548
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
drivers/net/wireless/bcmdhd/dhd_linux_platdev.c

index 1e189e898cc150e6f0d264cc91e50668ab16920c..4683f38cc71d6cfb3ed0ed5f7e197d7cd9706ad1 100644 (file)
@@ -879,7 +879,7 @@ static int dhd_wifi_platform_load_sdio(void)
        for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) {
                bool chip_up = FALSE;
                int retry;
-               struct semaphore dhd_chipup_sem;
+               static struct semaphore dhd_chipup_sem;
 
                adapter = &dhd_wifi_platdata->adapters[i];