From patchwork Wed Jun 1 16:39:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 840822 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p51GfmTH002535 for ; Wed, 1 Jun 2011 16:41:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754862Ab1FAQlq (ORCPT ); Wed, 1 Jun 2011 12:41:46 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:58326 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752637Ab1FAQlp (ORCPT ); Wed, 1 Jun 2011 12:41:45 -0400 Received: by wwa36 with SMTP id 36so6249940wwa.1 for ; Wed, 01 Jun 2011 09:41:44 -0700 (PDT) Received: by 10.216.232.41 with SMTP id m41mr7474321weq.31.1306946502628; Wed, 01 Jun 2011 09:41:42 -0700 (PDT) Received: from localhost.localdomain (109-186-65-238.bb.netvision.net.il [109.186.65.238]) by mx.google.com with ESMTPS id g2sm737158weg.14.2011.06.01.09.41.40 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2011 09:41:42 -0700 (PDT) From: Ohad Ben-Cohen To: Cc: , , Ohad Ben-Cohen Subject: [PATCH] media: omap3isp: fix a pontential NULL deref Date: Wed, 1 Jun 2011 19:39:46 +0300 Message-Id: <1306946386-31869-1-git-send-email-ohad@wizery.com> X-Mailer: git-send-email 1.7.1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 01 Jun 2011 16:41:51 +0000 (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 --- 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;