From de699c7a06797618c008ad3ca13bab34186298bc Mon Sep 17 00:00:00 2001 From: David Tardon Date: Wed, 3 Oct 2018 12:48:58 +0200 Subject: [PATCH] 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. --- src/boot/efi/console.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boot/efi/console.h b/src/boot/efi/console.h index 10c5ce4ebd..b9ed6c70b3 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)