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
Paths
| Differential D6848 Authored by asomers on Jun 14 2016, 11:24 PM.
Tags None Referenced Files
Subscribers
Details
Summary sys/sys/bitstring.h include/bitstring.h Test Plan Existing ATF test cases
Diff Detail
Event Timelineasomers updated this object. Herald added a subscriber: imp. · View Herald TranscriptJun 14 2016, 11:24 PM2016-06-14 23:24:09 (UTC+0) gibbs edited edge metadata. Comment ActionsI 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? This revision is now accepted and ready to land.Jun 14 2016, 11:35 PM2016-06-14 23:35:42 (UTC+0) asomers edited edge metadata. Comment ActionsRestore bitstr_size to its originally intended purpose of calculating the This revision now requires review to proceed.Jun 15 2016, 5:23 PM2016-06-15 17:23:17 (UTC+0) 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. gibbs edited edge metadata. Comment ActionsI'm just not sure about the new dependency on sys/param.h. I leave that for you to decide. This revision is now accepted and ready to land.Jun 24 2016, 2:55 PM2016-06-24 14:55:51 (UTC+0) This revision now requires review to proceed.Jun 24 2016, 4:03 PM2016-06-24 16:03:59 (UTC+0) gibbs edited edge metadata. gibbs added inline comments.
This revision now requires changes to proceed.Jun 24 2016, 4:48 PM2016-06-24 16:48:07 (UTC+0) gibbs edited edge metadata. Comment ActionsPlease fix the extra whitespace and test both with and without a roundup2 defined prior to including the header before landing.
This revision is now accepted and ready to land.Jun 24 2016, 5:06 PM2016-06-24 17:06:03 (UTC+0) Closed by commit rS302180: Fix bitstring allocation on 32-bit platforms (authored by asomers). · Explain WhyJun 24 2016, 9:45 PM2016-06-24 21:45:06 (UTC+0) This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 17862 sys/sys/bitstring.h
tests/sys/sys/bitstring_test.c
|