Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp451798pxj; Thu, 20 May 2021 13:15:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxatr+jAFAQltkyN4ixedKzhGDVRn12zgPlsiC/NOA6dEhtJXS2xoKb/4d2K3XoRvOvKdHV X-Received: by 2002:a05:6638:1650:: with SMTP id a16mr8361270jat.23.1621541753178; Thu, 20 May 2021 13:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621541753; cv=none; d=google.com; s=arc-20160816; b=TVpDp+Y9neOa6XWhBPwASSgmxAAC83JgpZHiUsliK9Tgnr4+4yVaevlbmzMAm1hkAj uScH+83gMyEeDnDLkW1C0gr51JKcgX+h8NpEHnJ58LahkWyI7qzgg8nhqrgIAtXU56L4 tqMzDACBwl6eeuRhQIWMuYoG5TrZiU3Dw90ZRWY3ZmwOvPCoeT01L4Q31BV4es6U6hbh UEv8L5F4425SSWYu/sPe5ude/ZETWwq2UKl196n2VbSQAaHowzHU+uj6cWpAGlswpvX2 5gFr5P3AhRRunggB6lIg0JmSIPS1cSjRl/P8jG+oh2ExaWcDH2tzrP+9jWfSvialOnqy gD4w== 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=3Wac/jPcViyjV5sO2Y+fbXGDZ4IRGMhed4Dthe5jmkI=; b=D8GkvkMGkWw7xSP+ujxau3UQXM3W5Y58QYiV0ifQXZw65z6ari9QGn1JcKwR0iJwTY ZeXGbV9JnF4pi/8g/p3kUJKvgyndWQCrxJRfFM6gflffwUoErv2pgfUEKgHHVSX8x48y cz0fIjScgoPCi7kvmOohU5Vfleu1/pbVeXj4keqqdMZEKi0RJlXuGiqVOUAq65ckhV3K cXNCwe8+90SS1r12/Nh8pR0Q4p74xBS5sIBp5Skq0t9klT1ShwlNF+8au8cMIdXa7tR4 woFWL1Mdku4SoSAG+UTVkdjHCF2CxH1pVw2xKBSN4QVthhVu2D8DA0ltiom0x6IqdW7y vYvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=twXFIh0S; 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 x23si2792425jab.92.2021.05.20.13.15.40; Thu, 20 May 2021 13:15:53 -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=twXFIh0S; 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 S237864AbhETKsI (ORCPT + 99 others); Thu, 20 May 2021 06:48:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:60508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237118AbhETKbo (ORCPT ); Thu, 20 May 2021 06:31:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D1B8961C4B; Thu, 20 May 2021 09:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504345; bh=+M4i6ktyBU58oRwpCLaG/Vw6cjKHsxZvX6iGEZ/VBFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twXFIh0SjGNNwnFcPSty31V+JEXp+7Oiu27deVp3mcBuYWMAw8SRPm8obbTykDxEZ ZvSrpwDIvBWIb4ij/flEtHfKClyOj7AkdDqAf1MRpYn4bkW4N6brLrwdW6yPUj6biW iDg+Z9jbYJhu9cLjiuoVAhAQHUYFtl/50BohWTPI= 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 4.14 170/323] usb: gadget: r8a66597: Add missing null check on return from platform_get_resource Date: Thu, 20 May 2021 11:21:02 +0200 Message-Id: <20210520092125.939042957@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 84b227ede082..cf92f6aca433 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1855,6 +1855,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