From: David Tardon Date: Wed, 3 Oct 2018 10:48:58 +0000 (+0200) Subject: console: avoid promotion to signed int X-Git-Tag: v240~563^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de699c7a06797618c008ad3ca13bab34186298bc;p=thirdparty%2Fsystemd.git console: avoid promotion to signed int coverity message: sign_extension: Suspicious implicit sign extension: "keydata.Key.ScanCode" with type "UINT16" (16 bits, unsigned) is promoted in "keydata.Key.ScanCode << 16" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "keydata.Key.ScanCode << 16" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. --- diff --git a/src/boot/efi/console.h b/src/boot/efi/console.h index 10c5ce4ebdb..b9ed6c70b32 100644 --- a/src/boot/efi/console.h +++ b/src/boot/efi/console.h @@ -9,7 +9,7 @@ #define EFI_CONTROL_PRESSED (EFI_RIGHT_CONTROL_PRESSED|EFI_LEFT_CONTROL_PRESSED) #define EFI_ALT_PRESSED (EFI_RIGHT_ALT_PRESSED|EFI_LEFT_ALT_PRESSED) -#define KEYPRESS(keys, scan, uni) ((((UINT64)keys) << 32) | ((scan) << 16) | (uni)) +#define KEYPRESS(keys, scan, uni) ((((UINT64)keys) << 32) | (((UINT64)scan) << 16) | (uni)) #define KEYCHAR(k) ((k) & 0xffff) #define CHAR_CTRL(c) ((c) - 'a' + 1)