Page MenuHomeFreeBSD

x86/ucode: fix gcc uninitialised warning
Needs ReviewPublic

Authored by adrian on Sun, Feb 22, 4:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 26, 2:05 AM
Unknown Object (File)
Wed, Feb 25, 12:11 PM
Unknown Object (File)
Wed, Feb 25, 4:16 AM
Unknown Object (File)
Wed, Feb 25, 3:47 AM
Unknown Object (File)
Wed, Feb 25, 12:34 AM
Unknown Object (File)
Wed, Feb 25, 12:31 AM
Unknown Object (File)
Mon, Feb 23, 9:53 PM
Unknown Object (File)
Sun, Feb 22, 4:24 PM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 70879
Build 67762: arc lint + arc unit