Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp611131pxj; Thu, 20 May 2021 17:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyty+rO2ObtrrjgjW4heglwFyGi6aidLeSPvw1TGywThF/s6LNYfBaL9GwhgTHjrFdvydeh X-Received: by 2002:a05:6e02:ed2:: with SMTP id i18mr7967334ilk.22.1621558184039; Thu, 20 May 2021 17:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621558184; cv=none; d=google.com; s=arc-20160816; b=IysZ1lH6LZfAgyMFcNWaYaKBMpZGCmITgzA0HIpGwW2x20gaGXaKV2CuZZpEK3TBpH oAhueTKY8ZDKIoB2O00c0dafFZ8lOUNf6ISzLBnfLpIt2GOz7tFYtuF7mfnmvn2XSUNF KK5mzmp8OjXvnFk1G+WWi/fnHhGzD/XNWoYLYEvFig061DUhqb9dgcb4OZaDFXPdfhwe Z/zQAAggdg4unGK709CHjShT/E5xwROOgxA3UI78cIYmgZOJft3Ft9cjKcrpVeWCCB9n xbmAMun4/7k6D32Li6Ksr02AGs/PeKZ90P+/pMwr5bhiB9mQbTovPGuoy5DJLIM32+hy 7arQ== 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=2LfKnrmaM4iBJJuCJmzbgU6/dl3X1udwaXvjXro0Mj8=; b=EHTzb7lylNKn/L4Gu9dZzcMoJH8aKBHEhT/E14MdtMqY0KJBSPpmBi6cLCUp/TSX+v DnF5ZNchAtZGNGSHtdYXgiPY7L41gu6/gd05kKQJoxhqqRg7ELnLILCT2zITf0YDWUOx DTiOepJcW0Fs8zc7nkGNqCWwAA98+92hAPBT8RHR6aAtwxtYAw/HACsGCXK3++Ukh2ml k+ZD8RRpbj42m61TTNynA8DGvQI3shyf/GUQ1rQZWD/FRgU4yWX05AJAEG1v9nk06rdB 52Llcm86VUt1gf9gtluwJmDHtL8xJUc5r+kKs+hiHMOrzCzj3LEUWlBvMRpaerg8OfsB bLgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kmUxXywM; 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 l8si4381563iln.109.2021.05.20.17.49.31; Thu, 20 May 2021 17:49:44 -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=kmUxXywM; 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 S238612AbhETLfz (ORCPT + 99 others); Thu, 20 May 2021 07:35:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:38358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240311AbhETLPU (ORCPT ); Thu, 20 May 2021 07:15:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D6C761D5F; Thu, 20 May 2021 10:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505346; bh=K3kqNkfw+YSy/2fRZI+8PiLpzDaznKZLIu0GmOo7KSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmUxXywMy9eLroAn9rIXwwrqw9Uw7xQan/V/h4Kcjv1eLpp7A1+54FLfU6DH9EGjr xWbBQG9CEm+6WSE3IKKQrtTcUXyl8T+QNm61L2YD+eSgM+VdXtEDEbm3hUo3zi+ees f8phDjACs1N8aGHB7ZQL0ZO+EYJ0aE7deipxF4dE= 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.4 093/190] usb: gadget: r8a66597: Add missing null check on return from platform_get_resource Date: Thu, 20 May 2021 11:22:37 +0200 Message-Id: <20210520092105.279072782@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 e34094647603..4eb8e181763d 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1867,6 +1867,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