[DRBD-cvs] svn commit by lars - r3032 - branches/drbd-8.0/user - Explicit NULL argp for ioctls without arguments. Even i

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Aug 28 22:01:26 CEST 2007


Author: lars
Date: 2007-08-28 22:01:18 +0200 (Tue, 28 Aug 2007)
New Revision: 3032

Modified:
   branches/drbd-8.0/user/drbdmeta.c
Log:
Explicit NULL argp for ioctls without arguments.
Even if an ioctl does not take an argument,
we still have to provide an explicit NULL.
Otherwise we may fail with EFAULT "Bad address".
This worked so far only by accident.


Modified: branches/drbd-8.0/user/drbdmeta.c
===================================================================
--- branches/drbd-8.0/user/drbdmeta.c	2007-08-28 19:44:18 UTC (rev 3031)
+++ branches/drbd-8.0/user/drbdmeta.c	2007-08-28 20:01:18 UTC (rev 3032)
@@ -905,7 +905,7 @@
 		exit(20);
 	}
 
-	if (ioctl(cfg->md_fd, BLKFLSBUF) == -1) {
+	if (ioctl(cfg->md_fd, BLKFLSBUF, NULL) == -1) {
 		PERROR("WARN: ioctl(,BLKFLSBUF,) failed");
 	}
 
@@ -1509,7 +1509,7 @@
 		PERROR("fsync() failed");
 		err = -1;
 	}
-	if (ioctl(cfg->md_fd, BLKFLSBUF) == -1) {
+	if (ioctl(cfg->md_fd, BLKFLSBUF, NULL) == -1) {
 		PERROR("ioctl(,BLKFLSBUF,) failed");
 		err = -1;
 	}



More information about the drbd-cvs mailing list