OSDN Git Service

selinux: avoid implicit conversions in avtab code
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 7 Aug 2023 17:11:42 +0000 (19:11 +0200)
committerPaul Moore <paul@paul-moore.com>
Wed, 9 Aug 2023 23:07:47 +0000 (19:07 -0400)
commitdf9d4749250dd8ed56a91336c3c54ea7a52fd1c7
treef8d32144d1113ebc5dec00e3a8d58070f380327e
parent817199e006e514e6c39a17ed2e9fece1bd56b898
selinux: avoid implicit conversions in avtab code

Return u32 from avtab_hash() instead of int, since the hashing is done
on u32 and the result is used as an index on the hash array.

Use the type of the limit in for loops.

Avoid signed to unsigned conversion of multiplication result in
avtab_hash_eval() and perform multiplication in destination type.

Use unsigned loop iterator for index operations, to avoid sign
extension.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/avtab.c