Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp341303pxj; Thu, 20 May 2021 10:31:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcIt/ASTvDIRJjzZZBb5KNr95+Y33ymi1xIx8VulSAdmEiYK+YxrwV3gHr+4RMtUlEezJN X-Received: by 2002:a05:6402:1d3c:: with SMTP id dh28mr6242406edb.129.1621531897280; Thu, 20 May 2021 10:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621531897; cv=none; d=google.com; s=arc-20160816; b=NTxfB0GdvOsvMbHbitmXhUWdemcaFAhEDHnGss+/zadYjIv0XuCuDoe7MYP0iffAeK TwyE/OZOH4EESWGBvuMOV5LsoxUyADI93Tf90FTKD4DpzWOTd9kPtfANHKIJgAV5mb9p SsY6JNxUg3yEkz2K0gP0gf7nE6rEFSo6VbP+lGnDhwoi71flNxRzt0MVv8aVYhwg92eO ii4F4XXVvJL0fyt7oUiaOkJqpM2cQEHIbaMsX3//tLvwD6XkOdeVhDNZJ+UToWAmlt3u dFMRa9dLeE9fanNQoV4VBgwTa4kiUnA+bNuPeOD1UmkhW1TxdsbtlKIQLlX1XVPUZADt ml1A== 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=FTXVCAtCU8w+lLbQBki6Uu8p+saQK81Bj8lpBgttylw=; b=hqAnaEJi0fSxeC96pARF1tDdJAKCuP0BFsZu+qcgwZ0g55fbykYFkuUD/jnUtjCscE p1YiM7KPXWjOCdUwUviMrG3qFjfsNJ8XqXINfQEIcq8fzdoEX59cUDqd6QvIb6NMDQ2P oiXsGBTmITHKqgV0EwUy7FJgRiT6cGveT3Pqyg31/9etfIhpOUXLAJIHFVWs170jNktF Fgmdm5mK0aYCd5lsiJIsK42v5Ro1VTl77RSLV5y0H8pOjxqxBMenakeI/A/CF3GfPmVB jrlsMEmjFo8cAbD4YWATTl0zMSPjd3NqZc7Tnq5zyIXq9y0Gpo2AquexvuMJaYng2mD1 /bEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sewIuJC6; 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 dt22si3302544ejc.424.2021.05.20.10.31.12; Thu, 20 May 2021 10:31:37 -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=sewIuJC6; 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 S234513AbhETJ6n (ORCPT + 99 others); Thu, 20 May 2021 05:58:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:54306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234863AbhETJys (ORCPT ); Thu, 20 May 2021 05:54:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BB9D613E2; Thu, 20 May 2021 09:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503422; bh=5oGwd9sVylZULCsNXIx2agLgt3eSZTfeNp4OHANUHQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sewIuJC6Jo3zQCPYHF1M9n2za4QKvlv3pK6o5gS0t2MLQxBv7btR6yYcv5X36X/on 7kHQ8NW/JHAItGwFyusjnctLKiP2q+/hDqQ9oDJqrrPlHJN76oZodUKqWqu0PjswDE vHfeHrXxBEAek/UbxuJotk7KwmtaJABvjzPYkIm4= 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.19 213/425] usb: gadget: r8a66597: Add missing null check on return from platform_get_resource Date: Thu, 20 May 2021 11:19:42 +0200 Message-Id: <20210520092138.416202548@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 11e25a3f4f1f..a766476fd742 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1852,6 +1852,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