[2/2] Initialize all of datahead structure in nscd [BZ #16791]

Message ID 87y4yluv39.fsf@igel.home
State Committed
Headers

Commit Message

Andreas Schwab May 1, 2014, 8:01 p.m. UTC
  Siddhesh Poyarekar <siddhesh@redhat.com> writes:

> diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
> index c069bf6..ee16df6 100644
> --- a/nscd/nscd-client.h
> +++ b/nscd/nscd-client.h
> @@ -240,12 +240,17 @@ static inline time_t
>  datahead_init_common (struct datahead *head, nscd_ssize_t allocsize,
>  		      nscd_ssize_t recsize, uint32_t ttl)
>  {
> +  /* Initialize so that we don't write out junk in uninitialized data to the
> +     cache.  */
> +  memset (head, 0, sizeof (*head));

nscd-client.h: In function ‘datahead_init_common’:
nscd-client.h:245:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
   memset (head, 0, sizeof (*head));
   ^
nscd-client.h:245:3: warning: incompatible implicit declaration of built-in function ‘memset’ [enabled by default]

Andreas.

	* nscd/nscd-client.h: Include <string.h>.
  

Comments

Roland McGrath May 1, 2014, 8:07 p.m. UTC | #1
Please always say in the subject or body when you've already committed the
change.  By default we assume a patch is a request for review/approval.
(This one was clearly in the "obvious enough" category, but I had to
double-check that you had already committed and didn't need a reply.)


Thanks,
Roland
  

Patch

diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
index ee16df6..cabba49 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -24,6 +24,7 @@ 
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <string.h>
 #include <sys/types.h>
 #include <atomic.h>
 #include <nscd-types.h>