From patchwork Fri Aug 2 06:32:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 2837538 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B97F99F493 for ; Fri, 2 Aug 2013 06:49:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C62FD201ED for ; Fri, 2 Aug 2013 06:49:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECEC5201D5 for ; Fri, 2 Aug 2013 06:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755337Ab3HBGs6 (ORCPT ); Fri, 2 Aug 2013 02:48:58 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:54296 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754466Ab3HBGs5 (ORCPT ); Fri, 2 Aug 2013 02:48:57 -0400 Received: by mail-pd0-f181.google.com with SMTP id g10so324442pdj.26 for ; Thu, 01 Aug 2013 23:48:57 -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:in-reply-to:references :x-gm-message-state; bh=XApFO5m4P0ZoAx5RQDSHsk6O5U5Aj9oa4INyUAjeJNs=; b=IapsN6xvGrjQ07YE+4kg/n2dvcQz1GN47j+xdZELxLUFPnNahfTDnq+uJlAEsZ4D66 aWzD6EX8fEh1V6hnYKfTxt7i5m3d9ErdiDWq5xarnict2VcpGnh0xXov4gakoQs/288L qFiP8oU6TQv+QBFMM8G/cRU0ijj7tdiMcnXjRb0ySJyS/K2rkoV3ilYWEP8hHPWcsTpa MXrui7K1IcAFOCxcoao3VfSXLbCba8X/zcizsJ5bWA/ml/fVQW66vve2rtd885DZewFA rc0mT7PVWzWaSrr08hs/vRF9CfuiB8k2S8/McQt8ZI0V6upPcurV4/5NK9OXiSbS6cq9 3asg== X-Received: by 10.66.163.229 with SMTP id yl5mr8798594pab.69.1375426136929; Thu, 01 Aug 2013 23:48:56 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id 7sm5068399paf.22.2013.08.01.23.48.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 Aug 2013 23:48:56 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 3/3] [media] exynos4-is: Fix potential NULL pointer dereference Date: Fri, 2 Aug 2013 12:02:14 +0530 Message-Id: <1375425134-17080-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1375425134-17080-1-git-send-email-sachin.kamat@linaro.org> References: <1375425134-17080-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQmrC34jmUfaOLmG2y4lXZSbQ0HwtvcAT8qTxUPD7oSGYdBz1SCu7/eMXHtUFjg6q8CadriZ Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dev->of_node could be NULL. Hence check for the same and return before dereferencing it in the subsequent error message. Signed-off-by: Sachin Kamat --- drivers/media/platform/exynos4-is/fimc-lite.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index 08fbfed..214bde2 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -1513,6 +1513,9 @@ static int fimc_lite_probe(struct platform_device *pdev) if (of_id) drv_data = (struct flite_drvdata *)of_id->data; fimc->index = of_alias_get_id(dev->of_node, "fimc-lite"); + } else { + dev_err(dev, "device node not found\n"); + return -EINVAL; } if (!drv_data || fimc->index >= drv_data->num_instances ||