Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597796pxj; Wed, 12 May 2021 08:58:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1W6JkW8dOisi7RUCm+fvAaqX+SWGQGo8YDZXE+gxg59h3dlddC5tP7QFEsNYgdBUr15p2 X-Received: by 2002:aa7:db0c:: with SMTP id t12mr43947690eds.72.1620835099608; Wed, 12 May 2021 08:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835099; cv=none; d=google.com; s=arc-20160816; b=hox7IY2MJpCx/pZv72yVe0MJ68KJWUcC4SvTTP9zKd3NauH1pV5fScu3ZvDuXSYaWW T53scJT3colifkQGe5d8RUFv8nYzYN8Ksu0bkm6kNCo/3jvtoaGl/PaD8NEQs3X0HPd+ bq7O5CC2cM2NHUoeOYzSM9TWXmTTjb0y8yLnpwwn4ySYCZevr7vlLl6X9mvx6oDEaZ7Z ymceu/WXgn9vwURWNzxJycpS3AAM1aKqt7UgMVMfptp8LJlxo/7oDoe2xm6bROwSiD90 kJ/3EJkv2dLjrBVfgSLA2dQMgl3HRLXNOQyqM68EWwn+9Y+tQm/fYAvRCANl4MaiSrPy J2eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z6H/JSBzmkx+Ybctr7+i/I9hhYLyE1JOC8+Lyrgf+44=; b=KpLYWUWcys2MeY3ERFp81Pqrpl6ieh6y/tmP71PO6DsXlcmp0u7oD1uzvAVRh+mnLz cH+PyABbekQ5aOoBH0ZHVB2S2uFdgFMecaXdVZ7cxsQRPOigWMtfRCEmcGawqeBBWab9 31acKSDVVCV5ZkWCPdK6tOun6arExZXiPV/RWbTzSFJf15F/j7zLF0u9glbG9I0pL1IT JghbxF1bwqOTp9CP7ktZFH3jtOtUnmvMhg2JVtv7guQDyiJx0BuEtyarzzXYDBt5asCW KLSfYUDKUI/kcAvUSXHOLU5RBFNa/dWmALmApNOUbyrsgFozUY/PwE9Vdu82Y0N7SA+9 sfLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UaeHsyzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rs10si287334ejb.93.2021.05.12.08.57.56; Wed, 12 May 2021 08:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UaeHsyzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238076AbhELP5R (ORCPT + 99 others); Wed, 12 May 2021 11:57:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:40914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235306AbhELP1b (ORCPT ); Wed, 12 May 2021 11:27:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D21461C17; Wed, 12 May 2021 15:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832347; bh=nTIRnDruiozt48EnkzzPMjoni5i2+tipW2+sdS0xD38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UaeHsyzvzDFczfLXUVvWbDNQ4t1ffbtNcjSEzDO/diZDATIqvM/BNQWoNsMnsQ0aq 46q3POG9tyGGo/J1MEgkzed5YSnZJnP6LR3g9QJiFNtOqj3hp+Q4mvT2IPS3bJ6u3f aWGegDlGRP0zTWStZFgZc9nS5WkhdA6Q06NvKdrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Sasha Levin Subject: [PATCH 5.10 242/530] usb: gadget: r8a66597: Add missing null check on return from platform_get_resource Date: Wed, 12 May 2021 16:45:52 +0200 Message-Id: <20210512144827.792283563@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit 9c2076090c2815fe7c49676df68dde7e60a9b9fc ] The call to platform_get_resource can potentially return a NULL pointer on failure, so add this check and return -EINVAL if it fails. Fixes: c41442474a26 ("usb: gadget: R8A66597 peripheral controller support.") Signed-off-by: Colin Ian King Addresses-Coverity: ("Dereference null return") Link: https://lore.kernel.org/r/20210406184510.433497-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/r8a66597-udc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 896c1a016d55..65cae4883454 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1849,6 +1849,8 @@ static int r8a66597_probe(struct platform_device *pdev) return PTR_ERR(reg); ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!ires) + return -EINVAL; irq = ires->start; irq_trigger = ires->flags & IRQF_TRIGGER_MASK; -- 2.30.2