Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
makubacki opened this issue Nov 15, 2022 · 0 comments · Fixed by #107
Closed

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

makubacki opened this issue Nov 15, 2022 · 0 comments · Fixed by #107
Assignees
Labels
type:bug Something isn't working

Comments

@makubacki
Copy link
Member

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]
@makubacki makubacki added the type:bug Something isn't working label Nov 15, 2022
@makubacki makubacki self-assigned this Nov 15, 2022
makubacki added a commit that referenced this issue Nov 15, 2022
## Description

Fixes #106 

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

This change initializes the values as necessary to prevent the error.

- [ ] Breaking change?
- Will this change break pre-existing builds or functionality without
action being taken?
  **No** - Simple GCC compilation fix

## How This Was Tested

Verified compilation before (fails as shown above) and after (does not
fail) with fix in this change.

## Integration Instructions

None - This will resolve a GCC build error that may have been
encountered in the MFCI tests.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
github-actions bot pushed a commit to Erich-McMillan/mu_plus that referenced this issue Dec 9, 2022
## Description

Fixes microsoft#106 

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

This change initializes the values as necessary to prevent the error.

- [ ] Breaking change?
- Will this change break pre-existing builds or functionality without
action being taken?
  **No** - Simple GCC compilation fix

## How This Was Tested

Verified compilation before (fails as shown above) and after (does not
fail) with fix in this change.

## Integration Instructions

None - This will resolve a GCC build error that may have been
encountered in the MFCI tests.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
github-actions bot pushed a commit to Erich-McMillan/mu_plus that referenced this issue Dec 9, 2022
## Description

Fixes microsoft#106 

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

This change initializes the values as necessary to prevent the error.

- [ ] Breaking change?
- Will this change break pre-existing builds or functionality without
action being taken?
  **No** - Simple GCC compilation fix

## How This Was Tested

Verified compilation before (fails as shown above) and after (does not
fail) with fix in this change.

## Integration Instructions

None - This will resolve a GCC build error that may have been
encountered in the MFCI tests.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
github-actions bot pushed a commit to TaylorBeebe/mu_plus that referenced this issue Dec 9, 2022
## Description

Fixes microsoft#106 

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

This change initializes the values as necessary to prevent the error.

- [ ] Breaking change?
- Will this change break pre-existing builds or functionality without
action being taken?
  **No** - Simple GCC compilation fix

## How This Was Tested

Verified compilation before (fails as shown above) and after (does not
fail) with fix in this change.

## Integration Instructions

None - This will resolve a GCC build error that may have been
encountered in the MFCI tests.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
kenlautner pushed a commit that referenced this issue May 14, 2023
## Description

Fixes #106 

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

This change initializes the values as necessary to prevent the error.

- [ ] Breaking change?
- Will this change break pre-existing builds or functionality without
action being taken?
  **No** - Simple GCC compilation fix

## How This Was Tested

Verified compilation before (fails as shown above) and after (does not
fail) with fix in this change.

## Integration Instructions

None - This will resolve a GCC build error that may have been
encountered in the MFCI tests.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant