[PATCH 5/6] media: staging: atomisp: Fix potential NULL pointer dereference
From: Pankaj Bharadiya
Date: Wed May 23 2018 - 00:33:54 EST
In sh_css_config_input_network(), "stream" is being dereferenced
before it is null checked.
Fix it by moving the "stream" pointer dereference after it has been
properly null checked.
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@xxxxxxxxx>
---
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index c771e4b..eb84d51 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -529,11 +529,12 @@ static enum ia_css_err
sh_css_config_input_network(struct ia_css_stream *stream)
{
unsigned int fmt_type;
- struct ia_css_pipe *pipe = stream->last_pipe;
+ struct ia_css_pipe *pipe;
struct ia_css_binary *binary = NULL;
enum ia_css_err err = IA_CSS_SUCCESS;
assert(stream != NULL);
+ pipe = stream->last_pipe;
assert(pipe != NULL);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
--
2.7.4