Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Feb 2003 05:33:59 -0500
From:      Hiten Pandya <hiten@unixdaemons.com>
To:        current@FreeBSD.ORG
Subject:   KASSERT's for vfs_{get,copy}opt()
Message-ID:  <20030214103359.GA73639@unixdaemons.com>

next in thread | raw e-mail | index | archive | help

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello everyone.  This not something major, but I recently experienced
panics in some of my old QNX4 filesystem porting code, and an old 5.0
kernel with UNIONFS problems.

The kernel will panic if vfs_get/copyopt() was passed 'opts' as NULL.
It would be good to add KASSERT's to these calls.  I have passed this
patch around on IRC, and have not seen any objections.

Can the right maintainer of sys/kern/vfs_mount.c commit/review the
patch attached with this mail.  Also available from:

	http://www.unixdaemons.com/~hiten/work/diffs/vfs_mount.c.patch

Cheers.

-- 
Hiten Pandya (hiten@unixdaemons.com, hiten@uk.FreeBSD.org)
http://www.unixdaemons.com/~hiten/

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vfs_mount.c.patch"

Index: sys/kern/vfs_mount.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/vfs_mount.c,v
retrieving revision 1.97
diff -u -r1.97 vfs_mount.c
--- sys/kern/vfs_mount.c	21 Jan 2003 08:55:55 -0000	1.97
+++ sys/kern/vfs_mount.c	14 Feb 2003 09:40:18 -0000
@@ -1714,6 +1714,9 @@
 {
 	struct vfsopt *opt;
 
+	KASSERT(opts != NULL,
+	    ("vfs_getopt: caller passed 'opts' as NULL\n"));
+
 	TAILQ_FOREACH(opt, opts, link) {
 		if (strcmp(name, opt->name) == 0) {
 			if (len != NULL)
@@ -1742,6 +1745,9 @@
 	int len;
 {
 	struct vfsopt *opt;
+
+	KASSERT(opts != NULL,
+	    ("vfs_copyopt: caller passed 'opts' as NULL\n"));
 
 	TAILQ_FOREACH(opt, opts, link) {
 		if (strcmp(name, opt->name) == 0) {

--3MwIy2ne0vdjdPXF--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030214103359.GA73639>