From nobody Sat May 11 20:39:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106986+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106986+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=163.com ARC-Seal: i=1; a=rsa-sha256; t=1689670410; cv=none; d=zohomail.com; s=zohoarc; b=jlb1so0f6VPVY006ZBwWExGX/ZWkuFu9PEbb6GAePysf2mbnazK/vvUJYwT4wps6sPF7R23y8+2RwvSR1y0sFU+FXIq4Bh7g0lh81NXffwGyqfOVfLiwKMRLYnQvJO2yMQdPygEw4OBGnxdud5EIJx11nSi+g6n89z6xAWjFJec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689670410; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=XqUDO1uaEkzpKJCzMUyvpT5inXEEgA58z8mssIHkjh8=; b=WUK8aCzfFNs32Yt5YJDOenV5zL05rSr13GXsSKTskXK9zDdlb0q1xNICSRMhgCzXkSGVh09Lo/j9xNT4FBSBhMIUb6yKT1cONFsXspSoafjE4R5Yv74akmOgk7jMsLHdHvgpPNiTcLpkXPmHM8VJhTvZVxLAxRfZTeNR2Tba9XM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106986+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1689670410586592.7403425858063; Tue, 18 Jul 2023 01:53:30 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=Lja4AMtJ15f4Qtg/TcyghGPx2h1Qj41HNvCLLSXIwMU=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:From:To:Cc:Subject:Date:Message-Id:MIME-Version:X-CM-TRANSID:X-Coremail-Antispam:X-Originating-IP:X-CM-SenderInfo:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1689670410; v=1; b=lcMF4lhtX5PKGdpcqtjofmZKnljo3BEDGJ/TI+GMmDnyU0nckZkbk7nyYz0b2ZWccx+HFfKR CD0fQqAH/HiU4xTXlOIxr/FXN/TKnUt5FT1b8+/QWVZcR+7I1zsqSwwWRd+wjl3OGHfyRcdaQQS UmeYxsbsLcwD7xQhpveGE1JE= X-Received: by 127.0.0.2 with SMTP id vykjYY1788612x5spN6BGpJ8; Tue, 18 Jul 2023 01:53:30 -0700 X-Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.216]) by mx.groups.io with SMTP id smtpd.web10.2489.1689664046602854334 for ; Tue, 18 Jul 2023 00:07:28 -0700 X-Received: from localhost.localdomain (unknown [219.141.235.82]) by zwqz-smtp-mta-g0-4 (Coremail) with SMTP id _____wBXX4McOrZkKdGAAg--.20504S2; Tue, 18 Jul 2023 15:07:09 +0800 (CST) From: wangyzhaoz@163.com To: devel@edk2.groups.io Cc: Yang Wang , Michael D Kinney , Loh Tien Hock , Ooi Tzy Way , Ran Wang Subject: [edk2-devel] [PATCH] Silicon/Synopsys/DesignWare: DwEmacSnpDxe: Fix bug in EmacGetDmaStatus Date: Tue, 18 Jul 2023 15:07:07 +0800 Message-Id: <20230718070707.8819-1-wangyzhaoz@163.com> MIME-Version: 1.0 X-CM-TRANSID: _____wBXX4McOrZkKdGAAg--.20504S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxuF4kuF18Ww4rKF13Ary7Wrg_yoW5XrWxpa 4kAr42krWrGa13ZF13Aa4YgF15AFyIgrykCasFy3ZIqFnxJFW7u34fuFW3Ja4DWF1rtay3 GF9Yq34xCF1ayaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pE75oJUUUUU= X-Originating-IP: [219.141.235.82] X-CM-SenderInfo: 5zdqw5p2kd06i6rwjhhfrp/1tbiNR6wJWI0ems+dgAAsx Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,wangyzhaoz@163.com X-Gm-Message-State: 7MrJd66qqQROKAY7DrlJrfjhx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689670411230100001 Content-Type: text/plain; charset="utf-8" From: Yang Wang Check EmacGetDmaStatus input parameters IrqStat may be a null pointer. Cc: Michael D Kinney Cc: Loh Tien Hock Cc: Ooi Tzy Way Cc: Ran Wang Signed-off-by: Yang Wang --- .../Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c | 7 +++++-- .../Drivers/DwEmacSnpDxe/EmacDxeUtil.c | 16 ++++++++++++---- .../Drivers/DwEmacSnpDxe/EmacDxeUtil.h | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.= c b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c index 4cb3371d79..6805511a1d 100755 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c @@ -847,9 +847,12 @@ SnpGetStatus ( } =20 // Check DMA Irq status - EmacGetDmaStatus (IrqStat, Snp->MacBase); + Status =3D EmacGetDmaStatus (IrqStat, Snp->MacBase); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, "%a: error Status: %r\n", __func__, Status)); + } =20 - return EFI_SUCCESS; + return Status; } =20 =20 diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c= b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c index 3b982ce984..45b5a05f51 100755 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c @@ -489,16 +489,22 @@ EmacDmaStart ( } =20 =20 -VOID +EFI_STATUS EFIAPI EmacGetDmaStatus ( OUT UINT32 *IrqStat OPTIONAL, IN UINTN MacBaseAddress ) { - UINT32 DmaStatus; - UINT32 ErrorBit; - UINT32 Mask =3D 0; + UINT32 DmaStatus; + UINT32 ErrorBit; + UINT32 Mask =3D 0; + EFI_STATUS Status =3D EFI_SUCCESS; + + if (IrqStat =3D=3D NULL) { + Status =3D EFI_INVALID_PARAMETER; + goto EXIT; + } =20 DmaStatus =3D MmioRead32 (MacBaseAddress + DW_EMAC_DMAGRP_STATUS_OFST); @@ -602,6 +608,8 @@ EmacGetDmaStatus ( MmioOr32 (MacBaseAddress + DW_EMAC_DMAGRP_STATUS_OFST, Mask); +EXIT: + return Status; } =20 =20 diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h= b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h index c4c3653dc7..60f30ecd16 100755 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h @@ -339,7 +339,7 @@ EmacDmaStart ( ); =20 =20 -VOID +EFI_STATUS EFIAPI EmacGetDmaStatus ( OUT UINT32 *IrqStat OPTIONAL, --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106986): https://edk2.groups.io/g/devel/message/106986 Mute This Topic: https://groups.io/mt/100212047/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-