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.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 3:19 PM
Unknown Object (File)
Mar 14 2024, 2:16 PM
Unknown Object (File)
Feb 6 2024, 9:13 AM
Unknown Object (File)
Dec 22 2023, 9:25 PM
Unknown Object (File)
Dec 16 2023, 9:24 PM
Unknown Object (File)
Dec 4 2023, 8:00 AM
Unknown Object (File)
Apr 24 2023, 1:04 AM
Unknown Object (File)
Dec 17 2022, 12:40 AM
Subscribers

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
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."