Page MenuHomeFreeBSD

stand: Use calloc instead of malloc for initialization of filesystem devsw
ClosedPublic

Authored by audrey_rhelmot.io on Apr 8 2025, 1:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 10, 3:24 PM
Unknown Object (File)
Sat, Jan 10, 3:14 PM
Unknown Object (File)
Sat, Jan 10, 4:47 AM
Unknown Object (File)
Mon, Dec 29, 8:03 AM
Unknown Object (File)
Dec 17 2025, 8:21 AM
Unknown Object (File)
Dec 14 2025, 9:31 PM
Unknown Object (File)
Dec 7 2025, 6:30 PM
Unknown Object (File)
Dec 7 2025, 5:01 AM
Subscribers

Details

Summary

This change is required for https://reviews.freebsd.org/D49355, so that we can check if d_dev is uninitialized by checking if it's NULL.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Nice refactor! Thanks!

This revision is now accepted and ready to land.Apr 8 2025, 3:02 AM

Oh! I should have committed this ages ago.
Still need to look more closely at the label patch. Love the concept, unsure about a couple of details.

Hmm ...
Sorry to be picky here .. but if you look at the calloc(3) manpage:
void *calloc(size_t number, size_t size);

The number comes first, then the size, so those should all have been calloc(1, sizeof(struct XXX))