]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: kwbimage: Do not cast const pointers to non-const pointers
authorPali Rohár <pali@kernel.org>
Wed, 12 Jan 2022 17:20:51 +0000 (18:20 +0100)
committerStefan Roese <sr@denx.de>
Fri, 14 Jan 2022 10:39:16 +0000 (11:39 +0100)
Avoid casting const to non-const.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwbimage.h

index 8d37357e5abde422f228672d5e5340c768ed8779..c000cba4b8d195baee845df0cc88f1b2497de7db 100644 (file)
@@ -235,11 +235,11 @@ static inline int opt_hdr_v1_valid_size(const struct opt_hdr_v1 *ohdr,
 {
        uint32_t ohdr_size;
 
-       if ((void *)(ohdr + 1) > mhdr_end)
+       if ((const void *)(ohdr + 1) > mhdr_end)
                return 0;
 
        ohdr_size = opt_hdr_v1_size(ohdr);
-       if (ohdr_size < 8 || (void *)((uint8_t *)ohdr + ohdr_size) > mhdr_end)
+       if (ohdr_size < 8 || (const void *)((const uint8_t *)ohdr + ohdr_size) > mhdr_end)
                return 0;
 
        return 1;