From patchwork Sat Mar 2 20:40:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10836751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE36C1399 for ; Sat, 2 Mar 2019 20:49:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C74029A8B for ; Sat, 2 Mar 2019 20:49:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E9C62AB94; Sat, 2 Mar 2019 20:49:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DAFD29A8B for ; Sat, 2 Mar 2019 20:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726592AbfCBUtA (ORCPT ); Sat, 2 Mar 2019 15:49:00 -0500 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:53544 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfCBUs7 (ORCPT ); Sat, 2 Mar 2019 15:48:59 -0500 X-Greylist: delayed 523 seconds by postgrey-1.27 at vger.kernel.org; Sat, 02 Mar 2019 15:48:59 EST Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id E515A93A for ; Sat, 2 Mar 2019 20:40:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dReK-Bd0UdwQ for ; Sat, 2 Mar 2019 14:40:15 -0600 (CST) Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id B4751BC9 for ; Sat, 2 Mar 2019 14:40:15 -0600 (CST) Received: by mail-it1-f198.google.com with SMTP id v12so1608117itv.9 for ; Sat, 02 Mar 2019 12:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=y0xx9CNXAixKOH4s5a9j3si4MaIeGUmv4k00ayMuflo=; b=gztPNJBLGbWlOJbSRex3nzA5ccPx7vtzkktwN6hbhpQ1D4PZSQRZOSLhtM9lQniHOQ ENluWtq09STllAwZ4W9LMdZklm8BCpLSlgMcXWVo1MmTg7+IjN23XVqov8dUeC2mxPLr kTGNPlSO9P0dBFs7X023jWPCNfHtq0IWPMUBC2ZmSH3YeEETxf41YPEaVaNuGx+xb4Gy 7Ir//uFI+dmz5HxIxeVum0xJPsncaJLEGNzuskYa8qtPQHaThh0DGPX5YSykYl7Vn3Sa /fmly4T/eZkaZrUXqV3toWM2IBNZLymuM0T9gg11E9CuBeS+r+BBZXSfK6tQpgFwqbMd avbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y0xx9CNXAixKOH4s5a9j3si4MaIeGUmv4k00ayMuflo=; b=eOZG1SmglKzddVPtaKiwFQSGPJDfiPMCTwYfh64D9sXZqCe4oeRaN5y/s7ApsdvMCx xHhWAwtLzYNC3QqnGXRvd6HtIxHHW2VxbRjS+eIio+tt0GY0vcgF+QUIz+uSa+pmrtkw uraM5spHQuLZD0xgXQtT2TR0oh9Ypo/vt4rFbxO1OqKfPnR6NSxoQuqAw9+xYqT4L43h L1L1YQEVMx1Vn6f72/V0Zp3mz7ptACBCZKDWybnYTPASUcpQR+BFyHtfbnqi0VsGawSe IhH1dJoyyQWOeNyks5ekknAzABWRn8o2HsIpR0iSxTffNPwDfyGsD5OBq+mzF77tAGr9 Lcmg== X-Gm-Message-State: APjAAAVHWzomwjEuuiQNNHdlTYIbV2XJk7tuZRBXJTwkO8EIwCW5vZNJ XCz0e01C40AGzu0coe28w1c84Ajyr5fIChrDy2Rp6RmIq8esRnXbg+zRNvoNMQAVVkXUBpjZw0S MDUOllwpwmGsuEUELgnFsy8SxdgY= X-Received: by 2002:a24:9403:: with SMTP id j3mr1235070ite.44.1551559215171; Sat, 02 Mar 2019 12:40:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzFPLCWGb3LVhLsQB+BEE5/Cy74SW7BlFPgT6WLuCdLF/CUN441tV1U3tjfyq2f9sYQBipGSQ== X-Received: by 2002:a24:9403:: with SMTP id j3mr1235060ite.44.1551559214949; Sat, 02 Mar 2019 12:40:14 -0800 (PST) Received: from cs-u-syssec1.dtc.umn.edu (cs-u-syssec1.cs.umn.edu. [128.101.106.66]) by smtp.gmail.com with ESMTPSA id p141sm900936itb.39.2019.03.02.12.40.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Mar 2019 12:40:14 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Cc: kjlu@umn.edu, Bartlomiej Zolnierkiewicz , linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc Date: Sat, 2 Mar 2019 14:40:04 -0600 Message-Id: <20190302204006.9953-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Memory allocated, using kmalloc, for new_compat may fail. This patch checks for such an error and prevents potential NULL pointer dereference. Signed-off-by: Aditya Pakki --- drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c index 136d30484d02..0592c436b2da 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c @@ -111,6 +111,8 @@ static void __init omapdss_omapify_node(struct device_node *node) new_len = prop->length + strlen(prefix) * num_strs; new_compat = kmalloc(new_len, GFP_KERNEL); + if (!new_compat) + return; omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);