diff mbox

[media] s5k6aa: Fix possible NULL pointer dereference

Message ID 1348298907-20791-1-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat Sept. 22, 2012, 7:28 a.m. UTC
It is previously assumed that 'rect' could be NULL.
Hence add a check to print the members of 'rect' only when it is not
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/i2c/s5k6aa.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index 045ca7f..7531edb 100644
--- a/drivers/media/i2c/s5k6aa.c
+++ b/drivers/media/i2c/s5k6aa.c
@@ -1177,8 +1177,9 @@  static int s5k6aa_get_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
 
 	mutex_unlock(&s5k6aa->lock);
 
-	v4l2_dbg(1, debug, sd, "Current crop rectangle: (%d,%d)/%dx%d\n",
-		 rect->left, rect->top, rect->width, rect->height);
+	if (rect)
+		v4l2_dbg(1, debug, sd, "Current crop rectangle: (%d,%d)/%dx%d\n",
+			 rect->left, rect->top, rect->width, rect->height);
 
 	return 0;
 }