diff options
author | 2017-09-07 11:35:34 +0000 | |
---|---|---|
committer | 2017-09-07 11:35:34 +0000 | |
commit | 4d661fe08286eae646fd95cfaabd9d2efa55ef0a (patch) | |
tree | fd72fa15d4de7ee2b19ac42cfe9cdfdd72f51da4 /sys | |
parent | In elf_load_file() to not call free(9) with an uninitialized size (diff) | |
download | wireguard-openbsd-4d661fe08286eae646fd95cfaabd9d2efa55ef0a.tar.xz wireguard-openbsd-4d661fe08286eae646fd95cfaabd9d2efa55ef0a.zip |
nfs_connect() returns EINVAL at the beginning if nm_sotype is
invalid. But the compiler cannot know whether it has changed in
the meantime, so in the else case a bunch of variables would not
be initialized. Add a panic() there to change the compiler's
assumptions, the code should not be reached anyway.
found by clang -Wuninitialized; OK deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfs/nfs_socket.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index 4fb1c336fc8..383db1cb930 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.127 2017/09/05 08:02:48 mpi Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.128 2017/09/07 11:35:34 bluhm Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -357,6 +357,8 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) sizeof (u_int32_t)) * 2; rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR + sizeof (u_int32_t)) * 2; + } else { + panic("%s: nm_sotype %d", __func__, nmp->nm_sotype); } error = soreserve(so, sndreserve, rcvreserve); if (error) |