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: 1494241 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5DDCFDF2D2 for ; Sat, 22 Sep 2012 07:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753147Ab2IVHcF (ORCPT ); Sat, 22 Sep 2012 03:32:05 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:38815 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752070Ab2IVHcD (ORCPT ); Sat, 22 Sep 2012 03:32:03 -0400 Received: by pbbrr4 with SMTP id rr4so4104427pbb.19 for ; Sat, 22 Sep 2012 00:32:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=eWV0hzQfQoRbOHpXpiGTAlQGroVldLaOUDLr7w29oLE=; b=R5+oYstZpLoSTjGXMIWXBsUVr5D7erU+B96rVpkBBh5KJWrp3XVnfkeZpFK2a9Dk7E 12w4p33uFFxIIuk1KUEEB3bZEEObVVyAXMad3ipfaIqul13QJl4TOTueeRFjxhlnwjDN PSXUVh4F3NFDokQMdjScqwjKZ/ILV+L/sN0qvn1+Cc0W2Q3ftwf2NIZ1u8gJskAreXqF i6Gt2BvmZftkWQWId+cejeQOAAsMxxlx0SnZ+6jn1HA+TqnMuKt4f8aqxArwDsQDdAZp MThmXRgwK4Bl1sMiCt8Un2cHXKLOCTKtLZpyQq8OYvmYdpSpa2cI55KUfM4l19bv4PxZ SP2A== 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: ALoCoQnG6SdfvCbFaAvWYF8RMC8aAmSZbjZOfrl5cwM8scw+t1mwaBuI6HGdNeVu9r6IlP/GfvKi Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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; }