From fb67a8d4ef62387f8ed7d1ffc373a07475e70588 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 11 Jun 2014 19:37:34 -0400 Subject: [PATCH] viced: move host tmay fields before index The index field and those after it in struct host do not get zeroed when a host is reused. The placement of the tmay fields after index in commit 9a0a8ca4d186cf953b87d9fae1a35f66090b060c results in the use of uninitialized memory. This change moves the tmay fields before index which permits the HOST_TO_ZERO() macro to compute the correct size to be memset() to zero. Change-Id: I1f93bebb23c99eaa7826dafa8cd7497d1b49bb53 Reviewed-on: http://gerrit.openafs.org/11286 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Benjamin Kaduk Reviewed-by: D Brashear --- src/viced/host.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/viced/host.h b/src/viced/host.h index 8c8ba39..bb14504 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -73,16 +73,19 @@ struct host { afs_uint32 cpsCall; /* time of last cps call from this host */ struct Interface *interface; /* all alternate addr for client */ afs_uint32 cblist; /* index of a cb in the per-host circular CB list */ - /* - * These don't get zeroed, keep them at the end. - */ - afs_uint32 index; /* Host table index, for vicecb.c */ + unsigned int n_tmays; /* how many successful TellMeAboutYourself calls * have we made against this host? */ /* cache of the result of the last successful TMAY call to this host */ struct interfaceAddr tmay_interf; Capabilities tmay_caps; + /* + * These don't get zeroed, keep them at the end. If index doesn't + * follow an unsigned short then we need to pad to ensure that + * the index fields isn't zeroed. XXX + */ + afs_uint32 index; /* Host table index, for vicecb.c */ struct Lock lock; /* Write lock for synchronization of * VenusDown flag */ pthread_cond_t cond; /* used to wait on hcpsValid */ -- 1.9.4