From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "Wood, Brian J" Date: Thu, 14 Mar 2019 15:34:34 -0700 Subject: [PATCH] media: pci: Fix improper use of pointer before check This fixes the case where the function get_mem_sub_system() returns NULL and the use of wrapper_base pointer. Tracked-On:PKT-1813 Change-Id: I8a3e73b83a43f747dfa6fb3401c05a0eecf5bd96 Signed-off-by: Wood, Brian J --- drivers/media/pci/intel/ipu-wrapper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/pci/intel/ipu-wrapper.c b/drivers/media/pci/intel/ipu-wrapper.c index 47fa06202fdd..047c1f2ee2cf 100644 --- a/drivers/media/pci/intel/ipu-wrapper.c +++ b/drivers/media/pci/intel/ipu-wrapper.c @@ -307,6 +307,11 @@ u32 shared_memory_map(unsigned int ssid, unsigned int mmid, u64 addr) struct my_css_memory_buffer_item *buf = NULL; unsigned long flags; + if (!mine) { + pr_err("Invalid mem subsystem, return NULL"); + return NULL; + } + if ((void *)(unsigned long)addr == &alloc_cookie) return 0; -- https://clearlinux.org