vldb_check: off by one host address table error

Fix several off-by-one errors when traversing the IpMappedAddr
table in vldb_check. The last index (254) was not checked
in several places.

Change-Id: Ida5039fefa1fa55f6f647dee4ed3a26dd84a85d0
Reviewed-on: http://gerrit.openafs.org/7614
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Michael Meffie 2012-06-26 15:09:07 -04:00 committed by Derrick Brashear
parent 36c6c46bd0
commit a27a8a66c2

View File

@ -259,7 +259,7 @@ readheader(struct vlheader *headerp)
ntohl(headerp->vital_header.totalEntries[1]);
headerp->SIT = ntohl(headerp->SIT);
for (i = 0; i < MAXSERVERID; i++)
for (i = 0; i <= MAXSERVERID; i++)
headerp->IpMappedAddr[i] = ntohl(headerp->IpMappedAddr[i]);
for (i = 0; i < HASHSIZE; i++)
headerp->VolnameHash[i] = ntohl(headerp->VolnameHash[i]);
@ -323,7 +323,7 @@ writeheader(struct vlheader *headerp)
htonl(headerp->vital_header.totalEntries[1]);
headerp->SIT = htonl(headerp->SIT);
for (i = 0; i < MAXSERVERID; i++)
for (i = 0; i <= MAXSERVERID; i++)
headerp->IpMappedAddr[i] = htonl(headerp->IpMappedAddr[i]);
for (i = 0; i < HASHSIZE; i++)
headerp->VolnameHash[i] = htonl(headerp->VolnameHash[i]);
@ -887,7 +887,7 @@ CheckIpAddrs(struct vlheader *header)
e = (struct extentaddr *)&(MHblock[j]);
/* Search the IpMappedAddr array for the reference to this entry */
for (ipindex = 0; ipindex < MAXSERVERID; ipindex++) {
for (ipindex = 0; ipindex <= MAXSERVERID; ipindex++) {
if (((header->IpMappedAddr[ipindex] & 0xff000000) ==
0xff000000)
&&
@ -898,7 +898,7 @@ CheckIpAddrs(struct vlheader *header)
break;
}
}
if (ipindex >= MAXSERVERID)
if (ipindex > MAXSERVERID)
ipindex = -1;
else
serveraddrs[ipindex] = -1;