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: 31167 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9C36F20671 for ; Fri, 30 May 2014 10:29:02 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lj1sf1710325pab.1 for ; Fri, 30 May 2014 03:29:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=lzOZnHE8h7tEmssCZn8Zlkp3CIOOep/CaW+8+Ymx1lQ=; b=MU4Hj+tN4zZ/iXdJ8ULzFmeoRLLjyF6qFeTWOWkOdf2UOGYmteZ1Xf6GEgzLomRYkS wKOWKj49sTMXOhi5LJeZBNGyAOhTmOBToHtdY6aKW/HvuborBIYuucQjoPEb1SsqQ7UN 3zzQQbaurjkTLKgq1eQv0SDFmCGGwsR27/MtPGlmmbftAQFl/QuzJwtEfRdwbi1taGWu y0+FKbVBytP4UergRZInY4XWjmvUGyj/9FaylPqB3p+Izw68ww1M2VHDuKm+3OhYTic/ IPJAwvZSTDEhHGer0myr7RtIzT3b4P4zmP29+ufBYRQyZtjJ4PafAKS2FGiSs2X3rQYg Vrnw== X-Gm-Message-State: ALoCoQleqoVoXqwoQD009TMKtyr9i3QiGZ/rY8D0ebJBmqBR1ryZIl0ejOVVvy1FUZQGOPWEU4OS X-Received: by 10.66.232.38 with SMTP id tl6mr4669240pac.33.1401445741768; Fri, 30 May 2014 03:29:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.100 with SMTP id o91ls989570qgd.30.gmail; Fri, 30 May 2014 03:29:01 -0700 (PDT) X-Received: by 10.58.216.34 with SMTP id on2mr12958099vec.22.1401445741601; Fri, 30 May 2014 03:29:01 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id xk1si2658239vdc.56.2014.05.30.03.29.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 May 2014 03:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jw12so1849350veb.5 for ; Fri, 30 May 2014 03:29:01 -0700 (PDT) X-Received: by 10.220.139.198 with SMTP id f6mr198416vcu.47.1401445741534; Fri, 30 May 2014 03:29:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp100327vcb; Fri, 30 May 2014 03:29:01 -0700 (PDT) X-Received: by 10.68.178.194 with SMTP id da2mr16833050pbc.151.1401445740793; Fri, 30 May 2014 03:29:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ty7si5004109pab.10.2014.05.30.03.29.00; Fri, 30 May 2014 03:29:00 -0700 (PDT) Received-SPF: none (google.com: linux-fbdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932227AbaE3K27 (ORCPT + 1 other); 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-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: list List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)