All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] [media] exynos4-is: Fix potential null pointer dereferencing
@ 2013-04-15 12:03 Sachin Kamat
  2013-04-15 15:21 ` Sylwester Nawrocki
  0 siblings, 1 reply; 5+ messages in thread
From: Sachin Kamat @ 2013-04-15 12:03 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches

If fimc->drv_data is NULL, then fimc->drv_data->num_entities would
cause NULL pointer dereferencing.
While at it also remove the check for fimc->id being negative as 'id' is
unsigned variable and can't be less than 0.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/exynos4-is/fimc-core.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c
index f25807d..d388832 100644
--- a/drivers/media/platform/exynos4-is/fimc-core.c
+++ b/drivers/media/platform/exynos4-is/fimc-core.c
@@ -953,10 +953,9 @@ static int fimc_probe(struct platform_device *pdev)
 		fimc->drv_data = fimc_get_drvdata(pdev);
 		fimc->id = pdev->id;
 	}
-	if (!fimc->drv_data || fimc->id >= fimc->drv_data->num_entities ||
-	    fimc->id < 0) {
-		dev_err(dev, "Invalid driver data or device id (%d/%d)\n",
-			fimc->id, fimc->drv_data->num_entities);
+	if (!fimc->drv_data || fimc->id >= fimc->drv_data->num_entities) {
+		dev_err(dev, "Invalid driver data or device id (%d)\n",
+			fimc->id);
 		return -EINVAL;
 	}
 	if (!dev->of_node)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-17 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 12:03 [PATCH 1/1] [media] exynos4-is: Fix potential null pointer dereferencing Sachin Kamat
2013-04-15 15:21 ` Sylwester Nawrocki
2013-04-16  6:16   ` Sachin Kamat
2013-04-17 11:03     ` Sylwester Nawrocki
2013-04-17 11:09       ` Sachin Kamat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.