HomeFreeBSD

x86/ucode: fix gcc uninitialised warning

Description

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

Details

Provenance
adrianAuthored on Apr 26 2026, 11:03 PM
Reviewer
emaste
Differential Revision
D55439: x86/ucode: fix gcc uninitialised warning
Parents
rG4feeca3193c3: tail(1): Fix -r (reverse) to work on pseudo filesystems
Branches
Unknown
Tags
Unknown