git: a16159aa2e33 - stable/13 - makefs: do not call brelse if bread returns an error
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Mar 2023 15:59:33 UTC
The branch stable/13 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=a16159aa2e3358c9c89242627558707faf8f499f
commit a16159aa2e3358c9c89242627558707faf8f499f
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-03-13 20:51:51 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-03-21 15:58:40 +0000
makefs: do not call brelse if bread returns an error
If bread returns an error there is no bp to brelse. One of these
changes was taken from NetBSD commit 0a62dad69f62 ("This works well
enough to populate..."), the rest were found by looking for the same
pattern.
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39069
(cherry picked from commit bc33c99234a676c41cde63cce389dd6b8b70adfc)
---
usr.sbin/makefs/ffs/ffs_alloc.c | 2 --
usr.sbin/makefs/msdos/msdosfs_lookup.c | 4 ----
2 files changed, 6 deletions(-)
diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c
index b5fbb4111685..69cba0454b5f 100644
--- a/usr.sbin/makefs/ffs/ffs_alloc.c
+++ b/usr.sbin/makefs/ffs/ffs_alloc.c
@@ -305,7 +305,6 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
NULL, &bp);
if (error) {
- brelse(bp);
return (0);
}
cgp = (struct cg *)bp->b_data;
@@ -449,7 +448,6 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size)
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
NULL, &bp);
if (error) {
- brelse(bp);
return;
}
cgp = (struct cg *)bp->b_data;
diff --git a/usr.sbin/makefs/msdos/msdosfs_lookup.c b/usr.sbin/makefs/msdos/msdosfs_lookup.c
index dd6acb7ee37c..cebaad69e7d4 100644
--- a/usr.sbin/makefs/msdos/msdosfs_lookup.c
+++ b/usr.sbin/makefs/msdos/msdosfs_lookup.c
@@ -126,7 +126,6 @@ createde(struct denode *dep, struct denode *ddep, struct denode **depp,
if (dirclust != MSDOSFSROOT)
diroffset &= pmp->pm_crbomask;
if ((error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) != 0) {
- brelse(bp);
return error;
}
ndep = bptoep(pmp, bp, ddep->de_fndoffset);
@@ -158,7 +157,6 @@ createde(struct denode *dep, struct denode *ddep, struct denode **depp,
error = bread(pmp->pm_devvp, bn, blsize,
NOCRED, &bp);
if (error) {
- brelse(bp);
return error;
}
ndep = bptoep(pmp, bp, ddep->de_fndoffset);
@@ -213,7 +211,6 @@ readep(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
blsize = de_bn2off(pmp, pmp->pm_rootdirsize) & pmp->pm_crbomask;
bn = detobn(pmp, dirclust, diroffset);
if ((error = bread(pmp->pm_devvp, bn, blsize, NOCRED, bpp)) != 0) {
- brelse(*bpp);
*bpp = NULL;
return (error);
}
@@ -273,7 +270,6 @@ uniqdosname(struct denode *dep, struct componentname *cnp, u_char *cp)
}
error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
if (error) {
- brelse(bp);
return error;
}
for (dentp = (struct direntry *)bp->b_data;