From patchwork Tue Jan 29 08:01:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10785631 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 8957E1390 for ; Tue, 29 Jan 2019 08:01:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B2BF2BA8C for ; Tue, 29 Jan 2019 08:01:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F2652BA67; Tue, 29 Jan 2019 08:01:42 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E97C52BA67 for ; Tue, 29 Jan 2019 08:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9bLQ79lYaD+7g13G/XYWT2X/zLFTd/lbCc5FRMWk9ao=; b=ALapR6KNvzdRDG rle+JTW4hAiKLP7fDIm8Cq0GyTSWXfoTINrDLHwJ8JBpp/kXcuNHGZoCDzW/t/Z5p6zZ4aPJXiMaS jogd7Zfkww2xFQaMZVffgSTCVAU2eJ8lOU5SodPv/8sNDWgKLz+gTd1APZadsrJFj5mMZ0WaQbJjH ag1Gy7qFzo4YPKEIdGRnUSQZRviN2FSW20NkSEO9Wlyp1+RUWSNrlaT5J7Gh/WLsOtKNACmY8p2Kf yJFo9OuXBueC2xlxGxiYzEndUL60ccvUq98cR7ZGEAFc1oratBGOvlHLhuD+1hoedBP5uSpqJuQFT zZ4P3NrIxaPJj5KOLtMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1goOKx-0000GP-GS; Tue, 29 Jan 2019 08:01:39 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1goOKt-0000Ff-SC for linux-arm-kernel@lists.infradead.org; Tue, 29 Jan 2019 08:01:37 +0000 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C0F605A20DFE18E7A8A7; Tue, 29 Jan 2019 16:01:31 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Tue, 29 Jan 2019 16:01:25 +0800 From: YueHaibing To: , , , , Subject: [PATCH -next] irqchip/tango: Fix potential NULL pointer dereference Date: Tue, 29 Jan 2019 16:01:22 +0800 Message-ID: <20190129080122.20392-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190129_000136_082231_39504092 X-CRM114-Status: UNSURE ( 7.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YueHaibing , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There is a potential NULL pointer dereference in case kzalloc() fails and returns NULL. Fixes: 4bba66899ac6 ("irqchip/tango: Add support for Sigma Designs SMP86xx/SMP87xx interrupt controller") Signed-off-by: YueHaibing --- drivers/irqchip/irq-tango.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/irqchip/irq-tango.c b/drivers/irqchip/irq-tango.c index ae28d86..a63b828 100644 --- a/drivers/irqchip/irq-tango.c +++ b/drivers/irqchip/irq-tango.c @@ -191,6 +191,8 @@ static int __init tangox_irq_init(void __iomem *base, struct resource *baseres, panic("%pOFn: failed to get address", node); chip = kzalloc(sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; chip->ctl = res.start - baseres->start; chip->base = base;