From patchwork Sat Sep 22 07:28:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 11640 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7C12C23E53 for ; Sat, 22 Sep 2012 07:32:05 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1D157A18656 for ; Sat, 22 Sep 2012 07:32:05 +0000 (UTC) Received: by ieje10 with SMTP id e10so6574579iej.11 for ; Sat, 22 Sep 2012 00:32:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=eWV0hzQfQoRbOHpXpiGTAlQGroVldLaOUDLr7w29oLE=; b=QESdC/kg/fAwaxp/xH7uAWaR7yDoxixOBthcr/gRHBpXi2wUO4lwAlum46UhogsJYo ly0ru75LP5qSa4MOQsLs4lFuZesWM3ucRqarz1b2c1rYpPa8Y6E0Z5vUC6cc+sJByfK2 1jZFSMNGBO6UDaT8fCQqAXP38JJNxaIT5G8E8YrfhUWaPtwzxG8cnlgGWhHe2bGTgGCT I6mn0eBjTTsE5iLU3aY0OZEyPsWbi1OE0cYNjEa9Zn0dzRD3P969YKadPNeYKpUivEmU JgWiknn/UBm4A1DKpp/PkLv4Pq2YqbnHUI1rdf5YFcfPVddIGbfZp1ZLK9UQAGfn/tK0 MlUw== Received: by 10.50.0.193 with SMTP id 1mr592031igg.0.1348299124505; Sat, 22 Sep 2012 00:32:04 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp164741igc; Sat, 22 Sep 2012 00:32:03 -0700 (PDT) Received: by 10.68.134.228 with SMTP id pn4mr20993415pbb.147.1348299123490; Sat, 22 Sep 2012 00:32:03 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id gh6si13853239pbc.147.2012.09.22.00.32.02 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 22 Sep 2012 00:32:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by pbcmd12 with SMTP id md12so9710271pbc.37 for ; Sat, 22 Sep 2012 00:32:02 -0700 (PDT) Received: by 10.68.212.70 with SMTP id ni6mr21369017pbc.22.1348299122767; Sat, 22 Sep 2012 00:32:02 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id te6sm6321513pbc.29.2012.09.22.00.32.00 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 22 Sep 2012 00:32:02 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, mchehab@infradead.org, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH] [media] s5k6aa: Fix possible NULL pointer dereference Date: Sat, 22 Sep 2012 12:58:27 +0530 Message-Id: <1348298907-20791-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQm6r+LUj1aEgC4SVVdiQBgDZGPFV9uaKkCDtNhUArvEDb5FPGgcKwE3gJcygToT4mJhFs7S 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 --- drivers/media/i2c/s5k6aa.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) 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; }