[OpenAFS-devel] avc dereferenced w/o checking for null.

Derek Atkins warlord@MIT.EDU
17 Jun 2002 20:54:18 -0400


Considering it calls osi_Panic(), it's a superfluous check.
The difference is that you would oops at the dereference rather
than oops'ing at the osi_Panic().  Same difference, just a
different place.

-derek

Matthew Andrews <matt@slackers.net> writes:

> in src/afs/VNOPS/afs_vnop_read.c
> 
> in afs_UFSRead()
> we check to see if avc is non-null, but at this point, avc has already
> been dereferenced.
> this check does not seem to exist in MemRead().
> 
> I'm thinking that either this check should be moved earlier or is
> extraneous. any thoughts?
> 
> -Matthew Andrews
> 
> relevant excerpt(CVS-1.11.2.3 L596-604):
> 
>    AFS_STATCNT(afs_UFSRead);
>     if (avc->vc_error)
>         return EIO;
> 
>     /* check that we have the latest status info in the vnode cache */
>     if ((code = afs_InitReq(&treq, acred))) return code;
>     if (!noLock) {
>       if (!avc)
>            ^^^^ <---too late
>         osi_Panic ("null avc in afs_UFSRead");
> ...
> 
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-devel

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available