git: 2567b60f6253 - main - Fix for f4fc389.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Sep 2022 23:22:38 UTC
The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=2567b60f62534bf5b243972f85b4921bba837439 commit 2567b60f62534bf5b243972f85b4921bba837439 Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2022-09-06 23:22:03 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2022-09-06 23:22:03 +0000 Fix for f4fc389. Need to check for NULL pointer before using. Reported by: Peter Holm Sponsored by: The FreeBSD Foundation --- sbin/fsck_ffs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 87e3e34cc1ad..ba286a965513 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -583,7 +583,8 @@ linkup(ino_t orphan, ino_t parentdir, char *name) inoinfo(lfdir)->ino_linkcnt++; pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan); inp = getinoinfo(parentdir); - if (parentdir != (ino_t)-1 && (inp->i_flags & INFO_NEW) == 0) { + if (parentdir != (ino_t)-1 && inp != NULL && + (inp->i_flags & INFO_NEW) == 0) { printf("PARENT WAS I=%lu\n", (u_long)parentdir); /* * If the parent directory did not have to @@ -840,8 +841,7 @@ allocdir(ino_t parent, ino_t request, int mode) irelse(&ip); return (0); } - if ((inp = getinoinfo(ino)) == NULL) - inp = cacheino(dp, ino); + inp = cacheino(dp, ino); inp->i_parent = parent; inp->i_dotdot = parent; inoinfo(ino)->ino_state = inoinfo(parent)->ino_state;