libsepol: use correct error type to please UBSAN

The callback function apply in hashtap_map has a return type of int and
can return -1 on error.  Use int as type to save the return value to
avoid implicit conversions:

    hashtab.c:236:10: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
Christian Göttsche 2022-02-10 19:52:32 +01:00 committed by James Carter
parent 2d08c5dd89
commit 496002e7ea

View File

@ -224,8 +224,9 @@ int hashtab_map(hashtab_t h,
int (*apply) (hashtab_key_t k,
hashtab_datum_t d, void *args), void *args)
{
unsigned int i, ret;
unsigned int i;
hashtab_ptr_t cur;
int ret;
if (!h)
return SEPOL_OK;