ebitmap: detect invalid bitmap
When count is 0 and the highbit is not zero, the ebitmap is not valid and the internal node is not allocated. This causes issues when routines, like mls_context_isvalid() attempt to use the ebitmap_for_each_bit() and ebitmap_node_get_bit() as they assume a highbit > 0 will have a node allocated. Signed-off-by: William Roberts <william.c.roberts@intel.com>
This commit is contained in:
parent
b612314bf3
commit
33de30a284
|
@ -394,6 +394,10 @@ int ebitmap_read(ebitmap_t * e, void *fp)
|
|||
e->highbit, MAPSIZE);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (e->highbit && !count)
|
||||
goto bad;
|
||||
|
||||
l = NULL;
|
||||
for (i = 0; i < count; i++) {
|
||||
rc = next_entry(buf, fp, sizeof(uint32_t));
|
||||
|
|
Loading…
Reference in New Issue