malloc.c: Remove bogus __nonnull attribute

Message ID 20230711135923.38979-1-alx@kernel.org
State New
Headers
Series malloc.c: Remove bogus __nonnull attribute |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed

Commit Message

Alejandro Colomar July 11, 2023, 1:59 p.m. UTC
  This function doesn't accept pointers.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 malloc/malloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

DJ Delorie July 11, 2023, 4:55 p.m. UTC | #1
Alejandro Colomar via Libc-alpha <libc-alpha@sourceware.org> writes:
> This function doesn't accept pointers.

Does __nonnull() tell the compiler anything about not-pointers that
can't be zero?  Asking for a friend... ;-)

LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>

> -checked_request2size (size_t req) __nonnull (1)
> +checked_request2size (size_t req)
  
Alejandro Colomar July 11, 2023, 11:07 p.m. UTC | #2
On 2023-07-11 18:55, DJ Delorie wrote:
> Alejandro Colomar via Libc-alpha <libc-alpha@sourceware.org> writes:
>> This function doesn't accept pointers.
> 
> Does __nonnull() tell the compiler anything about not-pointers that
> can't be zero?  Asking for a friend... ;-)
> 
> LGTM
> Reviewed-by: DJ Delorie <dj@redhat.com>

Thanks!  :-)

Whoever applies this, you could also add:

Fixes: 7519dee356a0 ("malloc: Simplify checked_request2size interface")

> 
>> -checked_request2size (size_t req) __nonnull (1)
>> +checked_request2size (size_t req)
>
  

Patch

diff --git a/malloc/malloc.c b/malloc/malloc.c
index e2f1a615a4..ec97a96f57 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1315,7 +1315,7 @@  nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    MINSIZE in case the value is less than MINSIZE, or 0 if any of the
    previous checks fail.  */
 static inline size_t
-checked_request2size (size_t req) __nonnull (1)
+checked_request2size (size_t req)
 {
   if (__glibc_unlikely (req > PTRDIFF_MAX))
     return 0;