From patchwork Fri May 30 10:26:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 4269581 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0CE77BEEA7 for ; Fri, 30 May 2014 10:29:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DECB2037B for ; Fri, 30 May 2014 10:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5690D2018E for ; Fri, 30 May 2014 10:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932227AbaE3K27 (ORCPT ); Fri, 30 May 2014 06:28:59 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:48690 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932170AbaE3K27 (ORCPT ); Fri, 30 May 2014 06:28:59 -0400 Received: by mail-pa0-f46.google.com with SMTP id kq14so1571747pab.33 for ; Fri, 30 May 2014 03:28:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=92AHk51kyulNbntFumBKvV9ysI5UhGpUde8afkR3d/U=; b=YtCK/rIlXrCHKHj2Uepsb6rrTRF/mdAqOhOlkmEWKMV7oQoSCqozq9DVXIkhV6Evan 0wIXivV4/bDXUAfu8mpOMuntmSthI9tq/gwxiqCBNLRCNOReeLUb3+1mxS0XQDLtF1mq eWNt9ZP9raGTqeTCtgc9/E7CqBEXIdIMFZ3xI1mzSPGIWcRtyssajoLiCQEleAziKc0k dHj4gX5IMQFNDKFsMxdL7VyyKKbPaY1oBI+3vYNQpvBEk1N9e4pPuUTiLOLATfOlCUMX jkVJyG1GW2Mco4V6IiNXlaWGiJhFsl4U3QVpXsrFtJFzp70pdf3zFapoQ4xe3Mb43Xq4 yHXw== X-Gm-Message-State: ALoCoQmN/+x/ZjRylTEMJwcR+xxg8QDuuLlknHCghxfJ16fCYQGQEYsUVb+FcTfqfuxsf+sjoLYT X-Received: by 10.68.164.100 with SMTP id yp4mr16925140pbb.136.1401445738999; Fri, 30 May 2014 03:28:58 -0700 (PDT) Received: from linaro.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id fx5sm5664628pbb.62.2014.05.30.03.28.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 May 2014 03:28:58 -0700 (PDT) From: Sachin Kamat To: linux-fbdev@vger.kernel.org Cc: tomi.valkeinen@ti.com, plagnioj@jcrosoft.com, sachin.kamat@linaro.org Subject: [PATCH 1/1] video: omapdss: Fix potential null pointer dereference Date: Fri, 30 May 2014 15:56:34 +0530 Message-Id: <1401445595-22884-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 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 kmalloc can return null. Add a check to avoid potential null pointer dereference error when the pointer is accessed later. Signed-off-by: Sachin Kamat --- drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c index 99af9e88b2d8..2f0822ee3ff9 100644 --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c @@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root) { struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), GFP_KERNEL); - n->node = node; - n->root = root; - list_add(&n->list, &dss_conv_list); + if (n) { + n->node = node; + n->root = root; + list_add(&n->list, &dss_conv_list); + } } static bool __init omapdss_list_contains(const struct device_node *node)