Date: Tue, 01 May 2001 07:09:25 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: Bruce Evans <bde@zeta.org.au> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/fs/hpfs hpfs_vnops.c Message-ID: <58258.988693765@critter> In-Reply-To: Your message of "Tue, 01 May 2001 13:35:07 %2B1000." <Pine.BSF.4.21.0105011323010.31663-100000@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSF.4.21.0105011323010.31663-100000@besplex.bde.org>, Bruce Ev
ans writes:
>> Modified files:
>> sys/fs/hpfs hpfs_vnops.c
>> Log:
>> Uncut&paste som bogus use of VOP_BMAP in hpfs::VOP_STRATEGY.
>>
>> At the same time, eliminate uninitialized use of a vnode
>> pointer. Interesting GCC didn't spot this.
>
>This is because the pointer was supposed to be, and was, initialized by
>VOP_BMAP(). gcc must assume that foo(&bar) initializes `bar'.
But VOP_BMAP() was not called in all cases:
int
hpfs_strategy(ap)
struct vop_strategy_args /* {
struct buf *a_bp;
} */ *ap;
{
register struct buf *bp = ap->a_bp;
register struct vnode *vp = ap->a_vp;
struct vnode *nvp;
int error;
dprintf(("hpfs_strategy(): \n"));
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("hpfs_strategy: spec");
if (bp->b_blkno == bp->b_lblkno) {
error = VOP_BMAP(vp, bp->b_lblkno, &nvp, &bp->b_blkno, NULL, NULL);
if (error) {
printf("hpfs_strategy: VOP_BMAP FAILED %d\n", error);
bp->b_error = error;
bp->b_ioflags |= BIO_ERROR;
biodone(bp);
return (error);
}
if ((long)bp->b_blkno == -1)
vfs_bio_clrbuf(bp);
}
if ((long)bp->b_blkno == -1) {
biodone(bp);
return (0);
}
bp->b_dev = nvp->v_rdev;
VOP_STRATEGY(nvp, bp);
return (0);
}
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?58258.988693765>
