Module Name:    src
Committed By:   hannken
Date:           Mon Feb 21 17:07:45 UTC 2022

Modified Files:
        src/sys/ufs/ufs: ufs_readwrite.c

Log Message:
Fix wrong assertion, the negatiopn of "a && b" is "!a || !b" so we
need "DIP(ip, blocks) != 0" here.

Should fix PR kern/56725 (Panic when ls directory with device nodes
on an older ffs)


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/ufs/ufs/ufs_readwrite.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_readwrite.c
diff -u src/sys/ufs/ufs/ufs_readwrite.c:1.127 src/sys/ufs/ufs/ufs_readwrite.c:1.128
--- src/sys/ufs/ufs/ufs_readwrite.c:1.127	Wed Oct 20 03:08:19 2021
+++ src/sys/ufs/ufs/ufs_readwrite.c	Mon Feb 21 17:07:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_readwrite.c,v 1.127 2021/10/20 03:08:19 thorpej Exp $	*/
+/*	$NetBSD: ufs_readwrite.c,v 1.128 2022/02/21 17:07:45 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.127 2021/10/20 03:08:19 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.128 2022/02/21 17:07:45 hannken Exp $");
 
 #define	FS			struct fs
 #define	I_FS			i_fs
@@ -142,7 +142,7 @@ BUFRD(struct vnode *vp, struct uio *uio,
 
 	KASSERT(vp->v_type != VLNK || ip->i_size >= ump->um_maxsymlinklen);
 	KASSERT(vp->v_type != VLNK || ump->um_maxsymlinklen != 0 ||
-	    DIP(ip, blocks) == 0);
+	    DIP(ip, blocks) != 0);
 
 	if (uio->uio_offset > ump->um_maxfilesize)
 		return EFBIG;

Reply via email to