Page MenuHomeFreeBSD

x86/ucode: fix gcc uninitialised warning
ClosedPublic

Authored by adrian on Feb 22 2026, 4:17 PM.
Tags
None
Referenced Files
F156465641: D55439.id172448.diff
Wed, May 13, 9:06 PM
Unknown Object (File)
Sun, May 10, 5:17 PM
Unknown Object (File)
Sun, May 10, 11:00 AM
Unknown Object (File)
Sun, May 10, 11:00 AM
Unknown Object (File)
Sat, May 9, 11:30 PM
Unknown Object (File)
Sat, May 9, 11:22 PM
Unknown Object (File)
Tue, Apr 28, 1:45 AM
Unknown Object (File)
Mon, Apr 27, 9:19 PM
Subscribers

Details

Summary

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;
        |                ^~~~~~~~~~~~~

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable