diff options
author | Tormod Volden <debian.tormod@gmail.com> | 2024-07-24 00:03:22 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-16 18:34:43 +0000 |
commit | d63d5884d7c2f7660175161187ce90852bc2a891 (patch) | |
tree | 3aa73b895232000f962053987b68dfb50b63c966 | |
parent | f34a945a8024b8cb548168cae3a4a81600620ebb (diff) | |
download | edk2-d63d5884d7c2f7660175161187ce90852bc2a891.tar.gz |
ShellPkg/UefiShellLib: Only write value if successful conversion
The ShellConvertStringToUint64() function documentation says:
"Upon a successful return the value of the conversion."
So do not write any value if the conversion failed.
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
-rw-r--r-- | ShellPkg/Library/UefiShellLib/UefiShellLib.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index a512c2c251..9dde9fddfa 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -4234,15 +4234,17 @@ ShellConvertStringToUint64 ( Status = InternalShellStrDecimalToUint64 (Walker, &RetVal, StopAtSpace);
}
- if ((Value == NULL) && !EFI_ERROR (Status)) {
- return (EFI_NOT_FOUND);
+ if (EFI_ERROR (Status)) {
+ return EFI_INVALID_PARAMETER;
}
- if (Value != NULL) {
- *Value = RetVal;
+ if (Value == NULL) {
+ return EFI_NOT_FOUND;
}
- return (Status);
+ *Value = RetVal;
+
+ return EFI_SUCCESS;
}
/**
|