]> xenbits.xensource.com Git - xen.git/commit
libelf: avoid UB in elf_xen_feature_{get,set}()
authorJan Beulich <jbeulich@suse.com>
Thu, 20 Jun 2024 15:34:56 +0000 (17:34 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 21 Jun 2024 14:09:26 +0000 (15:09 +0100)
commit9e7c26ad8532c3efda174dee5ab8bdbeef1e4f6d
tree593e196a2c79c206890d2f4487536c875b01de20
parentc5746b021e573184fb92b601a0e93a295485054e
libelf: avoid UB in elf_xen_feature_{get,set}()

When the left shift amount is up to 31, the shifted quantity wants to be
of unsigned int (or wider) type.

While there also adjust types: get doesn't alter the array and returns a
boolean, while both don't really accept negative "nr". Drop a stray
blank each as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
xen/include/xen/libelf.h