[v3,10/32] elf: Make <alloc_buffer.h> usable in ld.so

Message ID 9c999f5c5ccb5d3850192760e40185cb1f04f603.1701944612.git.fweimer@redhat.com
State New
Headers
Series RELRO linkmaps |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer Dec. 7, 2023, 10:31 a.m. UTC
  __libc_alloc_buffer_create_failure used to snprintf, which is not
available in ld.so.  The size information in the error message
is probably not that useful, so remove it.
---
 malloc/alloc_buffer_create_failure.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
  

Comments

Joseph Myers Feb. 21, 2024, 5:19 p.m. UTC | #1
On Thu, 7 Dec 2023, Florian Weimer wrote:

> __libc_alloc_buffer_create_failure used to snprintf, which is not
> available in ld.so.  The size information in the error message
> is probably not that useful, so remove it.

This makes the size argument to __libc_alloc_buffer_create_failure unused; 
the start argument was already unused.  Unless there is some reason to 
have unused arguments (to look at them under a debugger, or something like 
that), which would need comments explaining the reason, I think it would 
be best to remove both unused arguments.
  

Patch

diff --git a/malloc/alloc_buffer_create_failure.c b/malloc/alloc_buffer_create_failure.c
index c9557cae5b..7a2c2b7b8f 100644
--- a/malloc/alloc_buffer_create_failure.c
+++ b/malloc/alloc_buffer_create_failure.c
@@ -22,9 +22,5 @@ 
 void
 __libc_alloc_buffer_create_failure (void *start, size_t size)
 {
-  char buf[200];
-  __snprintf (buf, sizeof (buf), "Fatal glibc error: "
-              "invalid allocation buffer of size %zu\n",
-              size);
-  __libc_fatal (buf);
+  __libc_fatal ("Fatal glibc error: invalid allocation buffer\n");
 }