Bug 209305

Summary: Code to malloc should use struct <NAME> instead of pointer as per style guidelines
Product: Base System Reporter: Shawn Debnath <sd>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Not A Bug    
Severity: Affects Many People    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for malloc using struct none

Description Shawn Debnath 2016-05-05 20:22:28 UTC
Created attachment 170020 [details]
Patch for malloc using struct

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
Comment 1 Shawn Debnath 2016-05-05 20:25:39 UTC
Review: https://reviews.freebsd.org/D6233
Comment 2 Shawn Debnath 2016-05-05 20:44:03 UTC
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.