diff options
| author | Adrian Chadd <adrian@FreeBSD.org> | 2026-04-26 23:03:02 +0000 |
|---|---|---|
| committer | Adrian Chadd <adrian@FreeBSD.org> | 2026-04-26 23:03:02 +0000 |
| commit | 92e5f6e1995acb10628ab210cc9f19dbf74f2948 (patch) | |
| tree | fbe5960e77b5d0b8aaa2baf1aa91aa9bd0d11c34 | |
| parent | 4feeca3193c316c18472cd40f215446fda3bd739 (diff) | |
x86/ucode: fix gcc uninitialised warning
This fixes the case where selected_size is never set to anything
in the loop. Whilst here, also set selected_fw to NULL so the case
of "no firmware" correctly sets everything to NULL/0.
```
--- ucode_subr.o ---
/workspace/src/sys/x86/x86/ucode_subr.c: In function 'ucode_amd_find':
/workspace/src/sys/x86/x86/ucode_subr.c:237:25: warning: 'selected_size' may be used uninitialized [-Wmaybe-uninitialized]
237 | *selected_sizep = selected_size;
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/ workspace/src/sys/x86/x86/ucode_subr.c:105:16: note: 'selected_size' was declared here
105 | size_t selected_size;
| ^~~~~~~~~~~~~
```
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D55439
| -rw-r--r-- | sys/x86/x86/ucode_subr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/x86/x86/ucode_subr.c b/sys/x86/x86/ucode_subr.c index 53d7cfc06769..9536ed7b8f7b 100644 --- a/sys/x86/x86/ucode_subr.c +++ b/sys/x86/x86/ucode_subr.c @@ -98,11 +98,11 @@ ucode_amd_find(const char *path, uint32_t signature, uint32_t *revision, const uint8_t *fw_data, size_t fw_size, size_t *selected_sizep) { const amd_10h_fw_header_t *fw_header; - const amd_10h_fw_header_t *selected_fw; + const amd_10h_fw_header_t *selected_fw = NULL; const equiv_cpu_entry_t *equiv_cpu_table; const section_header_t *section_header; const container_header_t *container_header; - size_t selected_size; + size_t selected_size = 0; uint16_t equiv_id; int i; |
