Skip to content

Conversation

@bernd-edlinger
Copy link
Member

Valgrind complains due to the uninitialized memory
between the struct members, assigning { 0 } was zeroing the memory
assigning { NULL, 0 } is like assigning member-wise, leaving
some bytes uninitialized.

Checklist
  • documentation is added or updated
  • tests are added or updated

@mspncp
Copy link
Contributor

mspncp commented Mar 28, 2019

I guess you either meant to say

Revert a change from b3d113e

or

Revert one change from b3d113e

but not "Revert a one change".

Copy link
Contributor

@mspncp mspncp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, provided the commit message is corrected and Travis succeeds.

@mspncp mspncp added the approval: review pending This pull request needs review by a committer label Mar 28, 2019
Valgrind complains due to the uninitialized memory
between the struct members, assigning { 0 } was zeroing the memory
assigning { NULL, 0 } is like assigning member-wise, leaving
some bytes uninitialized.
@bernd-edlinger bernd-edlinger force-pushed the revert_cosmetic_change_valgrind_complains branch from 06574ae to 700c5b8 Compare March 28, 2019 20:49
@bernd-edlinger
Copy link
Member Author

Right, I dropped the "a" now.

@bernd-edlinger bernd-edlinger changed the title Revert a one change from b3d113e Revert one change from b3d113e Mar 28, 2019
Copy link
Member

@kroeckx kroeckx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not actually result in any change, the padding bytes can still be uninitialized.

@t-j-h
Copy link
Member

t-j-h commented Mar 28, 2019

This should be a memset if you want to ensure the entire structure is cleared ... and if you are referencing the padding items in any context that means you are using the structure as a "whole" and that means it should have been initialised as a whole (via memset).

@kroeckx
Copy link
Member

kroeckx commented Mar 28, 2019 via email

@paulidale
Copy link
Contributor

Fixed in #8606

@paulidale paulidale closed this Mar 29, 2019
@bernd-edlinger
Copy link
Member Author

Note, but I saw similar constructs elsewhere.

@bernd-edlinger
Copy link
Member Author

For instance here:

struct {
pid_t pid;
CRYPTO_THREAD_ID tid;
uint64_t time;
} data = { 0 };

@paulidale
Copy link
Contributor

There are multiple instances of this :(

I checked the C89 standard and it is ambiguous in one place in indicates that this would initialise the first field to zero, leaving the rest undefined. In a later example the implication is that all fields would be initialised but no mention about padding.

Just to cause more confusion, for an array, any excess elements would be initialised to zero.

@paulidale
Copy link
Contributor

I've addressed all the rand ones in #8610. I believe they are all harmless since they are providing personalisation material.

I'll check other instances in the tree separately.

@paulidale paulidale mentioned this pull request Mar 29, 2019
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: review pending This pull request needs review by a committer branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants