[alsa-devel] [PATCH 1/3] ASoC: Samsung: Add NULL check in i2s.c

Sachin Kamat sachin.kamat at linaro.org
Fri Jan 24 11:53:22 CET 2014


'res' could be NULL from one of the operations above (line 1243). Thus
check 'res' for NULL before releasing the region to avoid null pointer
dereference.

Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
---
 sound/soc/samsung/i2s.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 92f64363427d..a9da24f34834 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1268,7 +1268,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 
 	return 0;
 err:
-	release_mem_region(regs_base, resource_size(res));
+	if (res)
+		release_mem_region(regs_base, resource_size(res));
 
 	return ret;
 }
-- 
1.7.9.5



More information about the Alsa-devel mailing list