diff options
author | yar <yar@FreeBSD.org> | 2006-06-29 19:22:05 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-06-29 19:22:05 +0000 |
commit | ba19b1ecd4d6f2950416c0596e5007ae8ffb5360 (patch) | |
tree | 3d6a9cdea9fbb33471c0beed7b40c5ae89e5a37c /sys/nfsclient | |
parent | fb752eb168e0c0461ca9c98b0c8452c4d96ec4a7 (diff) | |
download | FreeBSD-src-ba19b1ecd4d6f2950416c0596e5007ae8ffb5360.zip FreeBSD-src-ba19b1ecd4d6f2950416c0596e5007ae8ffb5360.tar.gz |
There is a consensus that ifaddr.ifa_addr should never be NULL,
except in places dealing with ifaddr creation or destruction; and
in such special places incomplete ifaddrs should never be linked
to system-wide data structures. Therefore we can eliminate all the
superfluous checks for "ifa->ifa_addr != NULL" and get ready
to the system crashing honestly instead of masking possible bugs.
Suggested by: glebius, jhb, ru
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/bootp_subr.c | 9 | ||||
-rw-r--r-- | sys/nfsclient/nfs_diskless.c | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c index 1b4eded..dfd2395 100644 --- a/sys/nfsclient/bootp_subr.c +++ b/sys/nfsclient/bootp_subr.c @@ -1048,10 +1048,11 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, sdl = NULL; TAILQ_FOREACH(ifa, &ifctx->ifp->if_addrhead, ifa_link) - if (ifa->ifa_addr->sa_family == AF_LINK && - (sdl = ((struct sockaddr_dl *) ifa->ifa_addr)) != NULL && - sdl->sdl_type == IFT_ETHER) - break; + if (ifa->ifa_addr->sa_family == AF_LINK) { + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + if (sdl->sdl_type == IFT_ETHER) + break; + } if (sdl == NULL) panic("bootpc: Unable to find HW address for %s", diff --git a/sys/nfsclient/nfs_diskless.c b/sys/nfsclient/nfs_diskless.c index 9aa2de1..bc62b50 100644 --- a/sys/nfsclient/nfs_diskless.c +++ b/sys/nfsclient/nfs_diskless.c @@ -132,8 +132,8 @@ nfs_setup_diskless(void) IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if ((ifa->ifa_addr->sa_family == AF_LINK) && - (sdl = ((struct sockaddr_dl *)ifa->ifa_addr))) { + if (ifa->ifa_addr->sa_family == AF_LINK) { + sdl = (struct sockaddr_dl *)ifa->ifa_addr; if ((sdl->sdl_type == ourdl.sdl_type) && (sdl->sdl_alen == ourdl.sdl_alen) && !bcmp(LLADDR(sdl), |