]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
cheri: malloc: avoid switch over uintptr_t
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Mon, 28 Mar 2022 12:57:10 +0000 (13:57 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 27 Oct 2022 13:46:53 +0000 (14:46 +0100)
We should use a type that guarantees to represent all address bits.
In CHERI C this would be ptraddr_t, but we use unsigned long for now
not to cause regressions on other targets where this type is missing.

malloc/mcheck-impl.c

index 00b766219b0c0c489673d7682d65ecc5bc4ebb62..e908bfd06242052715b0b61ac1a96b668c071511 100644 (file)
@@ -74,7 +74,7 @@ checkhdr (const struct hdr *hdr)
        an error and report it.  */
     return MCHECK_OK;
 
-  switch (hdr->magic ^ ((uintptr_t) hdr->prev + (uintptr_t) hdr->next))
+  switch (hdr->magic ^ ((unsigned long) hdr->prev + (unsigned long) hdr->next))
     {
     default:
       status = MCHECK_HEAD;