From patchwork Fri May 12 03:55:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 99703 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp115130qge; Thu, 11 May 2017 21:01:20 -0700 (PDT) X-Received: by 10.84.218.133 with SMTP id r5mr2867768pli.19.1494561680292; Thu, 11 May 2017 21:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494561680; cv=none; d=google.com; s=arc-20160816; b=q6OrdQzpSazMniKqoGWaDxLCkNQ2LLSgP2sX6BU26WN3018h45yy6AH4Q/hka1FGPR r7JIPWl8Jd+pbKszgqIsog8Ar+/EfUmNLyfVh9bfAhiV6adC2gurvqnVT58zLf1i5vzE 8zv2xcq96IZtZvLeLc1kRZaxs6qcdsZR5ozYilRmcMR6+PmMuRrzWsr0gyTXBwji0WLP K0jvlUUy9FWInBuP3wHsr4uUXnSQ5VmBeC/oqg5UuK8hlMZ+JYafDm7PzhNficEa12v4 GtWMiwNZH3zN95ZTNdVeQLxm51HqLj8c38tGSEIAYXLdia3vW+3frvuBvZ+e3UozIIDb gmuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=BuDehm0B/hqMsFQU1NPeKr0KsQQmRBcw5W7cG7kgM3Y=; b=vX39vTEp/AGGxnL6SvOg7zDBd1N3q8SHPAsTvoBaMZYKIG2SoIOK/X9q7a0o1tCnXm vBcBxU0hI2DHGz2u2xuJhCRtmowIKCfS/D2GMcG9jqL0eitPVWZ6g6uvcsHPcy/g2Wm3 +hkvE2blbo2oja0JjsX3snJEJbXbnWDpRBB4GKVLNiGzIWy1makDMbG5dyZOh7BfFQmX VSoIhTZnlRFetDauNGXxjnDSVvR0NrGthntz3moTO99UxyljeeFhbUMyCCNCN+CZl7HI NDiEYgvnvnr4xdkmSiRyQmIEy31meP72SEGw9KdT3v/QNbTsGrDzF0JRfD6jhg5LZzlR 87nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si2119740pfk.396.2017.05.11.21.01.20; Thu, 11 May 2017 21:01:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756641AbdELEAt (ORCPT + 25 others); Fri, 12 May 2017 00:00:49 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6283 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbdELEAr (ORCPT ); Fri, 12 May 2017 00:00:47 -0400 Received: from 172.30.72.57 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AOJ23729; Fri, 12 May 2017 12:00:43 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Fri, 12 May 2017 12:00:34 +0800 From: Hanjun Guo To: Marc Zyngier , Thomas Gleixner CC: Kefeng Wang , Wei Yongjun , MaJun , , , Hanjun Guo Subject: [PATCH v2 2/3] irqchip/mbigen: Fix potential NULL dereferencing Date: Fri, 12 May 2017 11:55:27 +0800 Message-ID: <1494561328-39514-3-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1494561328-39514-1-git-send-email-guohanjun@huawei.com> References: <1494561328-39514-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5915336B.020C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7b943199f64b563d28b97e206066b791 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hanjun Guo platform_get_resource() may return NULL, add proper check to avoid potential NULL dereferencing. Signed-off-by: Hanjun Guo --- drivers/irqchip/irq-mbigen.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.7.12.4 diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index 0f5e66e..2fa1e45 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c @@ -337,6 +337,9 @@ static int mbigen_device_probe(struct platform_device *pdev) mgn_chip->pdev = pdev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + mgn_chip->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!mgn_chip->base) {