microsoft/mu_plus

MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c Fails to Compile on GCC

makubacki opened this issue · 0 comments

GCC states Dummy and FakeCertificate may be used uninitialized since it is not assigned an initial value before being passed to functions in some tests.

Dummy Example:

INFO - /s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:317:12: error: ‘Dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
INFO -   317 |   Status = ValidateBlobWithXdrCertificates (&Dummy, sizeof (Dummy), NULL, sizeof (mCert_Trusted_CA_Root_xdr));
INFO -       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:144:1: note: by argument 1 of type ‘const UINT8 *’ {aka ‘const unsigned char *’} to ‘ValidateBlobWithXdrCertificates’ declared here

FakeCertificate Example:

INFO - /s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:358:12: error: ‘FakeCertificate’ may be used uninitialized [-Werror=maybe-uninitialized]
INFO -   358 |   Status = ValidateBlobWithXdrCertificates (&Dummy, sizeof (Dummy), &FakeCertificate, sizeof (FakeCertificate));
INFO -       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Full error output:

INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c: In function ‘MfciMultipleCertificatesShouldCheckInputs’:
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:317:12: error: ‘Dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
INFO -   317 |   Status = ValidateBlobWithXdrCertificates (&Dummy, sizeof (Dummy), NULL, sizeof (mCert_Trusted_CA_Root_xdr));
INFO -       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:144:1: note: by argument 1 of type ‘const UINT8 *’ {aka ‘const unsigned char *’} to ‘ValidateBlobWithXdrCertificates’ declared here
INFO -   144 | ValidateBlobWithXdrCertificates (
INFO -       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:315:15: note: ‘Dummy’ declared here
INFO -   315 |   UINT8       Dummy;
INFO -       |               ^~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c: In function ‘MfciMultipleCertificatesShouldCheckGeneralCertificates’:
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:358:12: error: ‘Dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
INFO -   358 |   Status = ValidateBlobWithXdrCertificates (&Dummy, sizeof (Dummy), &FakeCertificate, sizeof (FakeCertificate));
INFO -       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:144:1: note: by argument 1 of type ‘const UINT8 *’ {aka ‘const unsigned char *’} to ‘ValidateBlobWithXdrCertificates’ declared here
INFO -   144 | ValidateBlobWithXdrCertificates (
INFO -       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:355:15: note: ‘Dummy’ declared here
INFO -   355 |   UINT8       Dummy;
INFO -       |               ^~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:358:12: error: ‘FakeCertificate’ may be used uninitialized [-Werror=maybe-uninitialized]
INFO -   358 |   Status = ValidateBlobWithXdrCertificates (&Dummy, sizeof (Dummy), &FakeCertificate, sizeof (FakeCertificate));
INFO -       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:144:1: note: by argument 3 of type ‘const UINT8 *’ {aka ‘const unsigned char *’} to ‘ValidateBlobWithXdrCertificates’ declared here
INFO -   144 | ValidateBlobWithXdrCertificates (
INFO -       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:356:15: note: ‘FakeCertificate’ declared here
INFO -   356 |   UINT8       FakeCertificate;
INFO -       |               ^~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c: In function ‘MfciMultipleCertificatesShouldCheckIndividualCertificate’:
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:395:12: error: ‘Dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
INFO -   395 |   Status = ValidateBlobWithXdrCertificates (&Dummy, sizeof (Dummy), FakeCertificate1, sizeof (FakeCertificate1));
INFO -       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:144:1: note: by argument 1 of type ‘const UINT8 *’ {aka ‘const unsigned char *’} to ‘ValidateBlobWithXdrCertificates’ declared here
INFO -   144 | ValidateBlobWithXdrCertificates (
INFO -       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO - /home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.c:387:15: note: ‘Dummy’ declared here
INFO -   387 |   UINT8       Dummy;
INFO -       |               ^~~~~
INFO - cc1: all warnings being treated as errors
INFO - make: *** [GNUmakefile:352: /home/vsts/work/1/s/Build/MfciPkg/NOOPT_GCC5/X64/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest/OUTPUT/MfciMultipleCertsHostTest.obj] Error 1
INFO - 
INFO - 
INFO - build.py...
INFO -  : error 7000: Failed to execute command
INFO - 	make tbuild [/home/vsts/work/1/s/Build/MfciPkg/NOOPT_GCC5/X64/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest]
INFO - 
INFO - 
INFO - build.py...
INFO -  : error F002: Failed to build module
INFO - 	/home/vsts/work/1/s/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf [X64, GCC5, NOOPT]