public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf/tlsdeschtab.h: Add the Malloc return value check in _dl_make_tlsdesc_dynamic()
@ 2022-11-04  9:30 Xiaoming Ni
  2022-11-04 11:00 ` Szabolcs Nagy
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaoming Ni @ 2022-11-04  9:30 UTC (permalink / raw)
  To: drepper, szabolcs.nagy, libc-alpha; +Cc: nixiaoming, wangle6, wangbing6

Check the return value of malloc based on the function header comment of
 _dl_make_tlsdesc_dynamic(). If the return value fails, NULL is returned.

Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
---
 elf/tlsdeschtab.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/elf/tlsdeschtab.h b/elf/tlsdeschtab.h
index 8c02e45a49..82733159e3 100644
--- a/elf/tlsdeschtab.h
+++ b/elf/tlsdeschtab.h
@@ -110,6 +110,8 @@ _dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset)
     }
 
   *entry = td = malloc (sizeof (struct tlsdesc_dynamic_arg));
+  if (! td)
+    return 0;
   /* This may be higher than the map's generation, but it doesn't
      matter much.  Worst case, we'll have one extra DTV update per
      thread.  */
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-07 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  9:30 [PATCH] elf/tlsdeschtab.h: Add the Malloc return value check in _dl_make_tlsdesc_dynamic() Xiaoming Ni
2022-11-04 11:00 ` Szabolcs Nagy
2022-11-05  2:34   ` Xiaoming Ni
2022-11-07 13:34     ` Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).