diff mbox

media: omap3isp: fix a pontential NULL deref

Message ID 1306946386-31869-1-git-send-email-ohad@wizery.com (mailing list archive)
State RFC
Headers show

Commit Message

Ohad Ben Cohen June 1, 2011, 4:39 p.m. UTC
Fix a potential NULL pointer dereference by skipping registration of
external entities in case none are provided.

This is useful at least when testing mere memory-to-memory scenarios.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
 drivers/media/video/omap3isp/isp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Laurent Pinchart June 2, 2011, 4:49 p.m. UTC | #1
Hi Ohad,

On Wednesday 01 June 2011 18:39:46 Ohad Ben-Cohen wrote:
> Fix a potential NULL pointer dereference by skipping registration of
> external entities in case none are provided.
> 
> This is useful at least when testing mere memory-to-memory scenarios.
> 
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>

Applied, thanks.

> ---
>  drivers/media/video/omap3isp/isp.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/omap3isp/isp.c
> b/drivers/media/video/omap3isp/isp.c index 2a5fbe6..367ced3 100644
> --- a/drivers/media/video/omap3isp/isp.c
> +++ b/drivers/media/video/omap3isp/isp.c
> @@ -1756,7 +1756,7 @@ static int isp_register_entities(struct isp_device
> *isp) goto done;
> 
>  	/* Register external entities */
> -	for (subdevs = pdata->subdevs; subdevs->subdevs; ++subdevs) {
> +	for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
>  		struct v4l2_subdev *sensor;
>  		struct media_entity *input;
>  		unsigned int flags;
diff mbox

Patch

diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c
index 2a5fbe6..367ced3 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -1756,7 +1756,7 @@  static int isp_register_entities(struct isp_device *isp)
 		goto done;
 
 	/* Register external entities */
-	for (subdevs = pdata->subdevs; subdevs->subdevs; ++subdevs) {
+	for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
 		struct v4l2_subdev *sensor;
 		struct media_entity *input;
 		unsigned int flags;