From nobody Fri May 17 06:07:43 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+86418+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+86418+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1644258899; cv=none; d=zohomail.com; s=zohoarc; b=OWy1dbCjH8y6byGX/SqTfrrsudr9nf8TlVW3OXPQ6086DPh91VDn1gB5RDGExhpTmTBcJa8wBAOcC+NFKMXu2GzkrNcNjXKwJdO0hrkJm82QhhEo/H3nqppPGaL1d/m24JWHT/o4C7QZREhXMyqreE+GDuXyMjRCCvHIRXG0myM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644258899; 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=gWzPTir3QAFGXuWO4g/lK6sQ+PzZkJt5podjoLMFvsk=; b=bA/oFThDw5gO0yB89ZtZdRljFvvE5Wto7obErhRfhacceSC2xrKC1gLpWVbb5X/OGhbJUucn+dnoFqer46YzHXjhUwHQAoQrQ0NHX7F18o9UICEjN9y7tutJTvchd41j0fjW4Gpea9tbMPaTEhALH5k/I7YmCMgfsVIbGJLcEus= 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+86418+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 1644258899468923.9031089685274; Mon, 7 Feb 2022 10:34:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id YToAYY1788612xjtU5bW1zN2; Mon, 07 Feb 2022 10:34:59 -0800 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.3830.1644038399934169309 for ; Fri, 04 Feb 2022 21:20:01 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="235888996" X-IronPort-AV: E=Sophos;i="5.88,344,1635231600"; d="scan'208";a="235888996" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 21:19:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,344,1635231600"; d="scan'208";a="600422894" X-Received: from babios003.gar.corp.intel.com ([10.66.244.222]) by fmsmga004.fm.intel.com with ESMTP; 04 Feb 2022 21:19:57 -0800 From: "MohammedX Rehan" To: devel@edk2.groups.io Cc: MohammedX Rehan Subject: [edk2-devel] [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure Date: Sat, 5 Feb 2022 10:49:54 +0530 Message-Id: MIME-Version: 1.0 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,mohammedx.rehan@intel.com X-Gm-Message-State: VniOoptgMno106K5RVUs7QKNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1644258899; bh=zEb4PafLsU6r9vYUZSSfZxHQ1+KOIJI1zGgBSfIOrBs=; h=Cc:Date:From:Reply-To:Subject:To; b=RItPLrgJjt/tkZJ7nFUvqUSY5SqUooumn4Y8Sbb+s4ehoWcny3MIs9vd1S8HnPXCiBq oG9bXh3Baydq2JtNY8Fip2DWdo/WGf7X9NT0TGmV91jyBKuqcqiNPasJAnwG3d7tTaSmX RyRlOclzBXf1QBaLX+vwZaJfqo1pLGOgDCI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1644258900638100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3819 Ping GetTimerPeriod API returns sometime zero value when StallCounter has smaller value than RttTimerTick (divide by zero) which results some failure at ping UEFI shell command Change-Id: I1d84fa1614278c77535b92255f875718b0376aef Signed-off-by: MohammedX Rehan --- ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPk= g/Library/UefiShellNetwork1CommandsLib/Ping.c index ec1e0a188b..93656e67c1 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -259,9 +259,11 @@ GetTimerPeriod ( EFI_EVENT TimerEvent; UINT32 StallCounter; EFI_TPL OldTpl; + UINT32 TimerPeriod; =20 RttTimerTick =3D 0; StallCounter =3D 0; + TimerPeriod =3D 0; =20 Status =3D gBS->CreateEvent ( EVT_TIMER | EVT_NOTIFY_SIGNAL, @@ -295,7 +297,12 @@ GetTimerPeriod ( gBS->SetTimer (TimerEvent, TimerCancel, 0); gBS->CloseEvent (TimerEvent); =20 - return StallCounter / RttTimerTick; + TimerPeriod =3D StallCounter / RttTimerTick; + if (TimerPeriod) { + return TimerPeriod; + } else { + return 1; + } } =20 /** --=20 2.30.0.windows.2 -=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 (#86418): https://edk2.groups.io/g/devel/message/86418 Mute This Topic: https://groups.io/mt/88978781/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-