From: Siddhesh Poyarekar Date: Thu, 29 Jan 2015 05:00:09 +0000 (+0530) Subject: Initialize nscd stats data [BZ #17892] X-Git-Tag: glibc-2.21~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cb26316b45b23dc5cfecbafdc489b28c3a52029;p=platform%2Fupstream%2Fglibc.git Initialize nscd stats data [BZ #17892] The padding bytes in the statsdata struct are not initialized, due to which valgrind throws a warning: ==11384== Memcheck, a memory error detector ==11384== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==11384== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==11384== Command: nscd -d ==11384== Fri 25 Apr 2014 10:34:53 AM CEST - 11384: handle_request: request received (Version = 2) from PID 11396 Fri 25 Apr 2014 10:34:53 AM CEST - 11384: GETSTAT ==11384== Thread 6: ==11384== Syscall param socketcall.sendto(msg) points to uninitialised byte(s) ==11384== at 0x4E4ACDC: send (in /lib64/libpthread-2.12.so) ==11384== by 0x11AF6B: send_stats (in /usr/sbin/nscd) ==11384== by 0x112F75: nscd_run_worker (in /usr/sbin/nscd) ==11384== by 0x4E439D0: start_thread (in /lib64/libpthread-2.12.so) ==11384== by 0x599AB6C: clone (in /lib64/libc-2.12.so) ==11384== Address 0x15708395 is on thread 6's stack Fix the warning by initializing the structure. --- diff --git a/ChangeLog b/ChangeLog index 0340bbe..faccea3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-01-29 Siddhesh Poyarekar + + [BZ #17892] + * nscd/nscd_stat.c (send_stats): Initialize DATA. + 2015-01-28 Martin Sebor * math/README.libm-test: Clarify. Add "How to read the test output." diff --git a/NEWS b/NEWS index 1dcfc7d..8e2729b 100644 --- a/NEWS +++ b/NEWS @@ -18,7 +18,7 @@ Version 2.21 17657, 17658, 17664, 17665, 17668, 17682, 17702, 17717, 17719, 17722, 17723, 17724, 17725, 17732, 17733, 17744, 17745, 17746, 17747, 17748, 17775, 17777, 17780, 17781, 17782, 17791, 17793, 17796, 17797, 17803, - 17806, 17834, 17844, 17848, 17868, 17869, 17870, 17885 + 17806, 17834, 17844, 17848, 17868, 17869, 17870, 17885, 17892. * A new semaphore algorithm has been implemented in generic C code for all machines. Previous custom assembly implementations of semaphore were diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c index 0f1f3c0..7aaa21b 100644 --- a/nscd/nscd_stat.c +++ b/nscd/nscd_stat.c @@ -94,6 +94,8 @@ send_stats (int fd, struct database_dyn dbs[lastdb]) struct statdata data; int cnt; + memset (&data, 0, sizeof (data)); + memcpy (data.version, compilation, sizeof (compilation)); data.debug_level = debug_level; data.runtime = time (NULL) - start_time;