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: Fix GCC compilation issue in a test #107

Merged

Conversation

makubacki
Copy link
Member

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

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.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki
Copy link
Member Author

Note: This PR will not pass build due to the DFCI_ZERO_XML target failing which needs a mu_devops change (microsoft/mu_devops#22).

Please review this change in the meantime so once that is in, this can fix mu_plus and unblock other pull requests.

@makubacki
Copy link
Member Author

Note: This PR will not pass build due to the DFCI_ZERO_XML target failing which needs a mu_devops change (microsoft/mu_devops#22).

Please review this change in the meantime so once that is in, this can fix mu_plus and unblock other pull requests.

Well, this did not build DfciPkg (which makes sense since the only change is in MfciPkg) so it did not trigger the failure that the change in mu_devops fixes. Therefore, the PR build did pass with this change alone.

@makubacki makubacki merged commit f27c665 into microsoft:release/202208 Nov 15, 2022
github-actions bot pushed a commit to Erich-McMillan/mu_plus that referenced this pull request 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 pull request 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 pull request 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 pull request 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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