aboutsummaryrefslogtreecommitdiff
path: root/malloc/arena.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2017-02-09 17:28:54 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-02-09 17:28:54 +0100
commit58520986c38e34db60e07260c64c563e3efcf353 (patch)
tree58e82d735221aba2766d43cb72864aaa26100746 /malloc/arena.c
parentdb0242e3023436757bbc7c488a779e6e3343db04 (diff)
downloadglibc-58520986c38e34db60e07260c64c563e3efcf353.zip
glibc-58520986c38e34db60e07260c64c563e3efcf353.tar.gz
glibc-58520986c38e34db60e07260c64c563e3efcf353.tar.bz2
Fix getting tunable values on big-endian (BZ #21109)
The code to set value passed a tunable_val_t, which when cast to int32_t on big-endian gives the wrong value. Instead, use tunable_val_t.numval instead, which can then be safely cast into int32_t. (cherry picked from commit 8cbc826c37c0221ada65a7a622fe079b4e89a4b0)
Diffstat (limited to 'malloc/arena.c')
-rw-r--r--malloc/arena.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/malloc/arena.c b/malloc/arena.c
index b91d7d6..d49e4a2 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -212,9 +212,9 @@ __malloc_fork_unlock_child (void)
#if HAVE_TUNABLES
static inline int do_set_mallopt_check (int32_t value);
void
-DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
+DL_TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
{
- int32_t value = *(int32_t *) valp;
+ int32_t value = (int32_t) valp->numval;
do_set_mallopt_check (value);
if (check_action != 0)
__malloc_check_init ();
@@ -223,9 +223,9 @@ DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
# define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \
static inline int do_ ## __name (__type value); \
void \
-DL_TUNABLE_CALLBACK (__name) (void *valp) \
+DL_TUNABLE_CALLBACK (__name) (tunable_val_t *valp) \
{ \
- __type value = *(__type *) valp; \
+ __type value = (__type) (valp)->numval; \
do_ ## __name (value); \
}