Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp858595pxb; Fri, 22 Apr 2022 12:48:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrjYwzHqMeEnvj817rcDqAfVaZztPwJJjyjd9Ao3xkEFm66skdPt9J9oNBrAsjIhxXuXU6 X-Received: by 2002:a63:ff08:0:b0:3aa:594e:5735 with SMTP id k8-20020a63ff08000000b003aa594e5735mr5197055pgi.183.1650656904373; Fri, 22 Apr 2022 12:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650656904; cv=none; d=google.com; s=arc-20160816; b=xuNfg8bubmqG2ToNIjYY6LF4XqUUl5cWxQnjEf/mKwwM/YR+YYkENFj2LsnHcgjC9i qYXZMPqIHBQo3Zs08Em/HJhbI8h+nts4px09M5KQTSn4n7HEvzwIyaUw/4VhA+i5Muew wKPV9xXMBapJ8LsrboB1mBouttas1+lxcN1pDafEKpBRgoAOpQQ+DikuTgOKRx3YLXNe lMsL/nP87+jENe2FGYvEHRRYiJJ6P8rErKXX+fYkfdad6J7Zq+2mqwyh/OVrL8/3anFc G7lOg2B9p6rP/FgMZvsaMhZirQ4Kq2njpdO/Q84NwVMG+8wdRxiiA8HGcjbbqmCP1eRp c5RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=LsvxuyiURN/Ofy9GA7OFSkaCtTxd5ha4hcARkgV8w8A=; b=LzCW6h59moAsNA7RRrTD4v/+UadASLVPTBYkbqgcwhsBcEBO1m2obI4qTNEG04Q+g3 Q3o3qa5kaSLG6EMFqd3lztdE0vJOPa4Dy7Dple6HLiefwkIF8LiqH170pIkHJdzueXsL hpV9GJ1XNd8C2pACOq3r6UaTWzK5koFrJs2hjD8O3YlBwBbJVd9DX3py714UTIr+70Mp 1/7/4yK1SREaGPSCN5QJmIrE2D//VltTN/b8JtLvySBp1ZlWVx3xiG5jVxSAwhw3TZ1o GCuShGNviF5h5hXTHfnWGiUhsAtKKsMFXAgnva366xN+gHJtOxvQA+5qjp0U7wpObTp4 AmqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="T/ceD57m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n16-20020a170902f61000b001584875c092si9495707plg.75.2022.04.22.12.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="T/ceD57m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E60F920F4DF; Fri, 22 Apr 2022 11:50:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443777AbiDVDiN (ORCPT + 99 others); Thu, 21 Apr 2022 23:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443759AbiDVDiL (ORCPT ); Thu, 21 Apr 2022 23:38:11 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1642813D4E; Thu, 21 Apr 2022 20:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1650598519; x=1682134519; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=LsvxuyiURN/Ofy9GA7OFSkaCtTxd5ha4hcARkgV8w8A=; b=T/ceD57mcIGHyK2LZA0JWkY5VWQStDXw1CnItfemCCP0Adx4IgMzQc1N 7bcyFzTR+k7X7mAjdTOYji3cshX30Daa50i3DgaY67h62bionevVA6Vk7 f7vty8tSUMnA20c++yTQPS+ehKioLh+wqP6rvptn+OVm1OQODT3CB1zOC k=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 21 Apr 2022 20:35:18 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 20:35:18 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 21 Apr 2022 20:35:18 -0700 Received: from [10.111.175.210] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 21 Apr 2022 20:35:16 -0700 Message-ID: Date: Thu, 21 Apr 2022 20:35:14 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] drm/msm/hdmi: check return value after calling platform_get_resource_byname() Content-Language: en-US To: Yang Yingliang , , , , CC: References: <20220422032227.2991553-1-yangyingliang@huawei.com> From: Abhinav Kumar In-Reply-To: <20220422032227.2991553-1-yangyingliang@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/21/2022 8:22 PM, Yang Yingliang wrote: > It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, > we need check the return value. > > Fixes: c6a57a50ad56 ("drm/msm/hdmi: add hdmi hdcp support (V3)") > Signed-off-by: Yang Yingliang Reviewed-by: Abhinav Kumar > --- > drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c > index ec324352e862..07e2ad527af9 100644 > --- a/drivers/gpu/drm/msm/hdmi/hdmi.c > +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c > @@ -142,6 +142,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev) > /* HDCP needs physical address of hdmi register */ > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > config->mmio_name); > + if (!res) { > + ret = -EINVAL; > + goto fail; > + } > hdmi->mmio_phy_addr = res->start; > > hdmi->qfprom_mmio = msm_ioremap(pdev, config->qfprom_mmio_name);