]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
shared: s/addu64_overflow/uadd64_overflow/g
authorEmil Velikov <emil.l.velikov@gmail.com>
Mon, 30 Sep 2024 21:36:29 +0000 (22:36 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 15 Oct 2024 17:35:38 +0000 (12:35 -0500)
Rename the helper closer to the actual built-in.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/169
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c
shared/util.h
testsuite/test-util.c

index bea83eca51facc9dad971e49d67434000371497b..a8dcdd83753ac375d4e771fe31ab56393f0e595e 100644 (file)
@@ -243,7 +243,7 @@ static inline int elf_get_section_info(const struct kmod_elf *elf, uint16_t idx,
        }
 #undef READV
 
-       if (addu64_overflow(*offset, *size, &min_size) || min_size > elf->size) {
+       if (uadd64_overflow(*offset, *size, &min_size) || min_size > elf->size) {
                ELFDBG(elf, "out-of-bounds: %" PRIu64 " >= %" PRIu64 " (ELF size)\n",
                       min_size, elf->size);
                return -EINVAL;
@@ -330,7 +330,7 @@ struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
                goto invalid;
        }
        shdrs_size = shdr_size * elf->header.section.count;
-       if (addu64_overflow(shdrs_size, elf->header.section.offset, &min_size) ||
+       if (uadd64_overflow(shdrs_size, elf->header.section.offset, &min_size) ||
            min_size > elf->size) {
                ELFDBG(elf, "file is too short to hold sections\n");
                goto invalid;
index 9bea27335d8f53f328d3a0c00fe31dd270c4f817..6fa4bf43c5cce5eb3500ca63201cbd385944a582 100644 (file)
@@ -92,7 +92,7 @@ static inline void freep(void *p)
 }
 #define _cleanup_free_ _cleanup_(freep)
 
-static inline bool addu64_overflow(uint64_t a, uint64_t b, uint64_t *res)
+static inline bool uadd64_overflow(uint64_t a, uint64_t b, uint64_t *res)
 {
 #if (HAVE___BUILTIN_UADDL_OVERFLOW && __SIZEOF_LONG__ == 8)
        return __builtin_uaddl_overflow(a, b, res);
index 2425ff9f015b8d53ab5626090364e4009d1fc42f..ce246d3982563041e7e61b35c6c74381adbc6391 100644 (file)
@@ -191,22 +191,22 @@ DEFINE_TEST(test_write_str_safe,
                },
        });
 
-static int test_addu64_overflow(const struct test *t)
+static int test_uadd64_overflow(const struct test *t)
 {
        uint64_t res;
        bool overflow;
 
-       overflow = addu64_overflow(UINT64_MAX - 1, 1, &res);
+       overflow = uadd64_overflow(UINT64_MAX - 1, 1, &res);
        assert_return(!overflow, EXIT_FAILURE);
        assert_return(res == UINT64_MAX, EXIT_FAILURE);
 
-       overflow = addu64_overflow(UINT64_MAX, 1, &res);
+       overflow = uadd64_overflow(UINT64_MAX, 1, &res);
        assert_return(overflow, EXIT_FAILURE);
 
        return EXIT_SUCCESS;
 }
-DEFINE_TEST(test_addu64_overflow,
-           .description = "check implementation of addu4_overflow()")
+DEFINE_TEST(test_uadd64_overflow,
+           .description = "check implementation of uadd64_overflow()")
 
 static int test_backoff_time(const struct test *t)
 {