ACK: [PATCH] lib: fwts_coreboot_cbmem: shift UL values rather than signed int values

ivanhu ivan.hu at canonical.com
Wed Nov 14 02:24:57 UTC 2018


On 11/13/18 8:43 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Shifting signed int values can result in undefined behaviour if the shift
> is 31 places.  Make all shifted values of 1 unsigned long to ensure there
> is no undefined behaviour. Cleans up clang error messages such as:
>
> error: Shifting signed 32-bit value by 31 bits is undefined behaviour
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_coreboot_cbmem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_coreboot_cbmem.c b/src/lib/src/fwts_coreboot_cbmem.c
> index e02c523c..3802a0af 100644
> --- a/src/lib/src/fwts_coreboot_cbmem.c
> +++ b/src/lib/src/fwts_coreboot_cbmem.c
> @@ -32,8 +32,8 @@
>  #include <fcntl.h>
>  
>  
> -#define CURSOR_MASK ((1 << 28) - 1)
> -#define OVERFLOW (1 << 31)
> +#define CURSOR_MASK ((1UL << 28) - 1)
> +#define OVERFLOW (1UL << 31)
>  
>  #define LB_TAG_CBMEM_CONSOLE	0x0017
>  #define LB_TAG_FORWARD		0x0011


Acked-by: Ivan Hu <ivan.hu at canonical.com>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20181114/fc91447f/attachment.sig>


More information about the fwts-devel mailing list