sys/sys/bitstring.h
Fix a rounding calculation that could undersize a bitstring on
32-bit platforms.
include/bitstring.h
Add sys/param.h for the roundup2 macro
Differential D6848
Fix bitstring allocation on 32-bit platforms asomers on Jun 14 2016, 11:24 PM. Authored by Tags None Referenced Files
Subscribers
Details
sys/sys/bitstring.h include/bitstring.h Existing ATF test cases
Diff Detail
Event TimelineComment Actions I see how this can over allocate on platforms with long > 8bits, but I'm missing how 32bit long platforms are special and can get too little space allocated. Can you provide an example in the checkin comment? Comment Actions Restore bitstr_size to its originally intended purpose of calculating the Comment Actions If I want to dynamically allocate a bitstr, I use bitstr_size() to tell me how much to allocate. Without the roundup, I'll potentially allocate too little memory.
Comment Actions Should we inline roundup2? Prior to this change, at least in user space, bitstring.h only relied on functionality provided in the C standard. It might be nice to keep that. Comment Actions I would say that you should use bit_alloc. But plenty of callers are doing it themselves. I'll do as you suggest, which will basically revert the 2nd diff of this review.
Comment Actions Are you happy with this @gibbs? Due to my vacation, I must commit today or it won't get into 11.0. Comment Actions I'm just not sure about the new dependency on sys/param.h. I leave that for you to decide.
Comment Actions Please fix the extra whitespace and test both with and without a roundup2 defined prior to including the header before landing.
|