[PATCH] malloc: Improve checked_request2size
DJ Delorie
dj@redhat.com
Fri Jun 6 21:17:34 GMT 2025
Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> Change checked_request2size to return PTRDIFF_T+1 for huge inputs. This
> ensures large allocation request stay large and can't be confused with a
> small allocation.
Every call to checked_request2size() immediately checks for 0 and
returns NULL if so. I don't see an opportunity for confusion here, and
comparing with 0 is far more efficient than comparing against a random
64-bit constant.
More information about the Libc-alpha
mailing list