summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHamad Kadmany <hkadmany@codeaurora.org>2015-06-10 10:20:01 +0300
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 19:57:50 -0700
commit572c609c0a6807acfd8bbb8483585ce41b494eb1 (patch)
tree9d4c5334052f22ebf2efa4dabfc37883de67ed60 /drivers
parent9ba9a18604e329936a4438382f8a2fe274923ff6 (diff)
msm_11ad: Add proper NULL check
Failure of memory allocation for context was not properly checked. Added proper check against valid context value in relevant locations. Change-Id: Ia74ddfb3c54e2781957e695a831c30f1356fed08 Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/msm/msm_11ad/msm_11ad.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/platform/msm/msm_11ad/msm_11ad.c b/drivers/platform/msm/msm_11ad/msm_11ad.c
index ac7b4dabd80b..2b6295bef849 100644
--- a/drivers/platform/msm/msm_11ad/msm_11ad.c
+++ b/drivers/platform/msm/msm_11ad/msm_11ad.c
@@ -170,7 +170,7 @@ static int msm_11ad_probe(struct platform_device *pdev)
int rc;
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
- if (!dev)
+ if (!ctx)
return -ENOMEM;
ctx->dev = dev;
@@ -402,6 +402,11 @@ int msm_11ad_modinit(void)
struct msm11ad_ctx,
list);
+ if (!ctx) {
+ pr_err("Context not found\n");
+ return -EINVAL;
+ }
+
if (ctx->pristine_state) {
/* in old kernels, pci_load_saved_state() is not exported;
* so use pci_load_and_free_saved_state()