Andrew Geissler | 80d4184 | 2023-09-11 08:36:15 -0400 | [diff] [blame^] | 1 | Platform/ARM: fix uninitialized variable FileSize in RunAxf |
| 2 | |
| 3 | Clang 14 detects a potentially uninitialized variable FileSize: |
| 4 | |
| 5 | RunAxf.c:216:11: error: variable 'FileSize' is used uninitialized |
| 6 | whenever 'if' condition is false |
| 7 | RunAxf.c:281:38: note: uninitialized use occurs here |
| 8 | WriteBackDataCacheRange (FileData, FileSize); |
| 9 | ^~~~~~~~ |
| 10 | |
| 11 | Reading the code it doesn't look like this can actually happen, but we |
| 12 | can keep clang happy by initialising FileSize to 0. |
| 13 | |
| 14 | Upstream-Status: Pending |
| 15 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 16 | |
| 17 | diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c b/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c |
| 18 | index d23739ad38..fba5e0ba30 100644 |
| 19 | --- a/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c |
| 20 | +++ b/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c |
| 21 | @@ -136,1 +136,1 @@ ShellDynCmdRunAxfHandler ( |
| 22 | - UINTN FileSize;
|
| 23 | + UINTN FileSize = 0;
|