diff options
author | Rehan, MohammedX <mohammedx.rehan@intel.com> | 2022-02-15 16:07:03 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-02-16 08:09:46 +0000 |
commit | 8a576733162bb72afb4d1eb3012b0aef8d265018 (patch) | |
tree | 175359ec4cdde8c80a0699b00dd2dd46b0acb5ef /ShellPkg/Library | |
parent | c28e376edc46e6db6e4a551c94b6ac90df0d8d6e (diff) | |
download | edk2-8a576733162bb72afb4d1eb3012b0aef8d265018.zip edk2-8a576733162bb72afb4d1eb3012b0aef8d265018.tar.gz edk2-8a576733162bb72afb4d1eb3012b0aef8d265018.tar.bz2 |
ShellPkg: Fix Ping GetTimerPeriod API failure
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3819
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
Signed-off-by: MohammedX Rehan <mohammedx.rehan@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r-- | ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c index ec1e0a1..6a002b1 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;
RttTimerTick = 0;
StallCounter = 0;
+ TimerPeriod = 0;
Status = gBS->CreateEvent (
EVT_TIMER | EVT_NOTIFY_SIGNAL,
@@ -295,7 +297,12 @@ GetTimerPeriod ( gBS->SetTimer (TimerEvent, TimerCancel, 0);
gBS->CloseEvent (TimerEvent);
- return StallCounter / RttTimerTick;
+ TimerPeriod = StallCounter / RttTimerTick;
+ if (TimerPeriod != 0) {
+ return TimerPeriod;
+ } else {
+ return 1;
+ }
}
/**
|