linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107: Possible int/long mixup ?

David Binderman dcb314 at hotmail.com
Mon Apr 14 11:02:45 PDT 2025


Hello there,

Static analyser cppcheck says:

linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107:2: style: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]

Source code is

   return 1 << (vm->va_bits - shift);

Maybe better code:

   return 1UL << (vm->va_bits - shift);

Regards

David Binderman



More information about the linux-arm-kernel mailing list