diff options
author | Mahesh Voorugonda <mvoorugo@codeaurora.org> | 2021-04-27 15:54:39 +0530 |
---|---|---|
committer | Mahesh Voorugonda <mvoorugo@codeaurora.org> | 2021-04-27 15:54:39 +0530 |
commit | b91b91bea5a37fc0f1de84e51fc3b3578986b66c (patch) | |
tree | d6568016daa9964d830ed4e108c99aca38d7817a | |
parent | 1a661700c013f5ca282031d759ce729e46cfe629 (diff) | |
download | video-driver-b91b91bea5a37fc0f1de84e51fc3b3578986b66c.tar.gz |
msm: vidc: Fix possible NULL pointer dereference
Added NULL pointer check for platform_data structure to avoid NULL
pointer dereference error. platform_data is initialized with return
value (driver_data) of vidc_get_drv_data() fucntion where driver_data is
initialized with NULL pointer at the beginning.
Change-Id: I24743cc6ed7ffcfa40feca2307c9b1728b5bc152
Signed-off-by: Mahesh Voorugonda <mvoorugo@codeaurora.org>
-rw-r--r-- | msm/vidc/msm_v4l2_vidc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/msm/vidc/msm_v4l2_vidc.c b/msm/vidc/msm_v4l2_vidc.c index 0fd761e..161661b 100644 --- a/msm/vidc/msm_v4l2_vidc.c +++ b/msm/vidc/msm_v4l2_vidc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> @@ -490,6 +490,11 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) return -ENOMEM; core->platform_data = vidc_get_drv_data(&pdev->dev); + if(!core->platform_data) { + d_vpr_e("Failed to get platform data\n"); + rc = -EINVAL; + goto err_core_init; + } dev_set_drvdata(&pdev->dev, core); rc = msm_vidc_initialize_core(pdev, core); if (rc) { |