summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTormod Volden <debian.tormod@gmail.com>2024-07-24 00:03:22 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-16 18:34:43 +0000
commitd63d5884d7c2f7660175161187ce90852bc2a891 (patch)
tree3aa73b895232000f962053987b68dfb50b63c966
parentf34a945a8024b8cb548168cae3a4a81600620ebb (diff)
downloadedk2-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.c12
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;
}
/**