Update meson platform to not rely on undefined overflow behaviour
authorJustin Chadwell <justin.chadwell@arm.com>
Wed, 3 Jul 2019 13:10:31 +0000 (14:10 +0100)
committerJustin Chadwell <justin.chadwell@arm.com>
Thu, 11 Jul 2019 11:10:58 +0000 (12:10 +0100)
This consists of ensuring that the left operand of each shift is
unsigned when the operation might overflow into the sign bit.

Change-Id: Ib7ec8ed3423e9b9b32be2388520bc27ee28f6370
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
drivers/meson/gxl/crypto/sha_dma.c

index 565099c4a76b35826ca60da088ec9bac1e9366c1..a969dea74c50bff8a13f3fad600f3f1c85a8f8f1 100644 (file)
@@ -104,8 +104,8 @@ struct asd_desc {
 #define ASD_DESC_ERR_SET(d, v)                                 \
        (ASD_DESC_SET((d)->cfg, v, ASD_DESC_ERR_MASK, ASD_DESC_ERR_OFF))
 
-#define ASD_DESC_OWNER_OFF 31
-#define ASD_DESC_OWNER_MASK 0x1
+#define ASD_DESC_OWNER_OFF 31u
+#define ASD_DESC_OWNER_MASK 0x1u
 #define ASD_DESC_OWNER(d)                                      \
        (ASD_DESC_GET((d)->cfg, ASD_DESC_OWNER_MASK, ASD_DESC_OWNER_OFF))
 #define ASD_DESC_OWNER_SET(d, v)                               \
@@ -126,7 +126,7 @@ static void asd_compute_sha(struct asd_ctx *ctx, void *data, size_t len,
        assert((uintptr_t)&desc == (uintptr_t)&desc);
 
        ASD_DESC_LEN_SET(&desc, len);
-       ASD_DESC_OWNER_SET(&desc, 1);
+       ASD_DESC_OWNER_SET(&desc, 1u);
        ASD_DESC_ENCONLY_SET(&desc, 1);
        ASD_DESC_EOD_SET(&desc, 1);
        if (ctx->started == 0) {