libafs: don't crash if afs_write() is called with zero-length uio
authorGarrett Wollman <wollman@csail.mit.edu>
Sat, 13 Aug 2011 22:34:47 +0000 (18:34 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 22 Aug 2011 19:13:06 +0000 (12:13 -0700)
commit5836464f454f0bb4612c665d27061956d4c745af
tree5cfa296e9614389d4ba3a37974950a3b5b7680c7
parent259eaa99155921c42888fce8c6c398252bd3b937
libafs: don't crash if afs_write() is called with zero-length uio

If AFS_UIO_RESID(auio) is zero in afs_write(), we could end up
calling afsio_free(NULL).  Guard the free.  (In the alternative,
perhaps we should just osi_Assert(totalLength > 0) instead?)

Change-Id: Ic218f039e2034b679cb4817a543af2e8307f36f8
Found-by: clang static analyzer with the help of AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5259
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/VNOPS/afs_vnop_write.c