checkpolicy: avoid implicit conversion

Avoid implicit conversions from signed to unsigned values, found by
UB sanitizers, by using unsigned values in the first place.

    dismod.c:92:42: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
Christian Göttsche 2021-09-14 14:48:25 +02:00 committed by James Carter
parent 16d7dde41c
commit c7c582a0ef

View File

@ -89,7 +89,7 @@ static void render_access_bitmap(ebitmap_t * map, uint32_t class,
fprintf(fp, "{"); fprintf(fp, "{");
for (i = ebitmap_startbit(map); i < ebitmap_length(map); i++) { for (i = ebitmap_startbit(map); i < ebitmap_length(map); i++) {
if (ebitmap_get_bit(map, i)) { if (ebitmap_get_bit(map, i)) {
perm = sepol_av_to_string(p, class, 1 << i); perm = sepol_av_to_string(p, class, UINT32_C(1) << i);
if (perm) if (perm)
fprintf(fp, " %s", perm); fprintf(fp, " %s", perm);
} }