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: 10836753 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 3FF0A1399 for ; Sat, 2 Mar 2019 20:49:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FCDD29A8B for ; Sat, 2 Mar 2019 20:49:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F7C42AB94; Sat, 2 Mar 2019 20:49:05 +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=unavailable 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 C0D0929A8B for ; Sat, 2 Mar 2019 20:49:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726610AbfCBUtE (ORCPT ); Sat, 2 Mar 2019 15:49:04 -0500 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:54994 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfCBUtD (ORCPT ); Sat, 2 Mar 2019 15:49:03 -0500 X-Greylist: delayed 526 seconds by postgrey-1.27 at vger.kernel.org; Sat, 02 Mar 2019 15:49:02 EST Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id B303BDC7 for ; Sat, 2 Mar 2019 20:40:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aa-iDSTom-j9 for ; Sat, 2 Mar 2019 14:40:15 -0600 (CST) Received: from mail-it1-f200.google.com (mail-it1-f200.google.com [209.85.166.200]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id 8646317C for ; Sat, 2 Mar 2019 14:40:15 -0600 (CST) Received: by mail-it1-f200.google.com with SMTP id j127so1616033itj.7 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=uii3sOy9w805Hg0F5NQEZREw9hplJmAU9vEicSNnsHoPje8ut5Uxml3Q4Hk+rPAebP J+bH5vCyzFwA6i7d72m71+bVWzQnUglHPlzVR2TY4KhS9+wv5qore6OVX5WulMMRFghF vXO0BzHwa5Ni6WahNa9UnmalFcsPmy9JVguKy/4HXiWepJHpETkjn9AEA1zUVi02WzNa jn87YAYe6+X2LffWS8qhV9uk8KtPsRDwCOPxWDQx9xCc5aPj3IRzYQTbEDyR2utOHEgs LciaRtxz7BiCxdh2w7AGphkcn5Z/9bldtOAEMgMoNse9+Itf8RisPrF0G+pye/sVPUFU +beA== X-Gm-Message-State: APjAAAV5cdy5tQnGMKxcwzFp1K5pen11VspIefxYgx/bTrfc3rbRbpnm GTxcFNWwNzH5202wipIdq8umYj3wW44z1U+ZJmu84HZo4f46xlq7MwuIYGjuSo7mDcz6g2R0ub+ INH5YT+VwWCIwtTPcE6oGtlb9jw== X-Received: by 2002:a24:9403:: with SMTP id j3mr1235067ite.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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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);