From: Garrett Wollman Date: Tue, 9 Aug 2011 04:28:27 +0000 (-0400) Subject: libafs: afs_CacheFetchProc can't be called without a dcache pointer X-Git-Tag: upstream/1.8.0_pre1^2~2129 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=77f258a71dde5bc8f82b5d6f24836cfee4e9bcce;p=packages%2Fo%2Fopenafs.git libafs: afs_CacheFetchProc can't be called without a dcache pointer An inspection of the only call site suggests that afs_CacheFetchProc() can't be called with a null dcache pointer, and code further down in this function dereferences adc unconditionally (assuming rxfs_fetchInit() doesn't crash first) so remove the conditional here. Probably more of these parameters can and should be included in the AFS_NONNULL. Change-Id: Ic87517376085b0d5bc7631b5558411259ae986f4 Reviewed-on: http://gerrit.openafs.org/5180 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c index bf019c460..610f1c6cc 100644 --- a/src/afs/afs_fetchstore.c +++ b/src/afs/afs_fetchstore.c @@ -1114,9 +1114,7 @@ afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn, osi_GetuTime(&xferStartTime); #endif /* AFS_NOSTATS */ - if (adc) { - adc->validPos = base; - } + adc->validPos = base; if ( !code ) do { if (avc->f.states & CForeign) { diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 13e336a8f..5418036b4 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -503,7 +503,8 @@ extern int afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn, struct osi_file *fP, afs_size_t abase, struct dcache *adc, struct vcache *avc, afs_int32 size, - struct afs_FetchOutput *tsmall); + struct afs_FetchOutput *tsmall) + AFS_NONNULL((5)); /* afs_memcache.c */ extern int afs_InitMemCache(int blkCount, int blkSize, int flags);