Page MenuHomeFreeBSD

209305 - Code to malloc should use struct <NAME> instead of pointer as per style guidelines
AbandonedPublic

Authored by sd_beastie.io on May 5 2016, 8:25 PM.

Details

Reviewers
cem
allanjude
Summary

In efipart.c, the code to malloc the phys dev info (struct pdinfo) is allocated via:

malloc(nin * sizeof(*pdinfo));

It should be

malloc(nin * sizeof(struct pdinfo));

according to style(9) and in general code guidelines in FreeBSD

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

sd_beastie.io retitled this revision from to 209305 - Code to malloc should use struct <NAME> instead of pointer as per style guidelines.
sd_beastie.io updated this object.
sd_beastie.io edited the test plan for this revision. (Show Details)
sd_beastie.io added reviewers: cem, allanjude.
sd_beastie.io set the repository for this revision to rS FreeBSD src repository - subversion.
cem requested changes to this revision.May 5 2016, 8:28 PM
cem edited edge metadata.

style(9) doesn't say that.

This revision now requires changes to proceed.May 5 2016, 8:28 PM

Better to use variable to obtain size to allocate so that in the future if variable type changes, compiler's won't produce warnings and harder to track down.

Even if style(9) says this, I vote "No Way Jose" and "Forget it" and "I'm likely to accidentally revert this when I merge my next changes."