Use kernel-space address with FUSE_DEBUG

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Use kernel-space address with FUSE_DEBUG

Thomas Jeunet
The following patch use the proper address space when using a kernel
with FUSE_DEBUG (kernel instead of user, see the copyin above). While
here, add some sanity check to the debug function fuse_dump_buff.

--
Thomas Jeunet

Index: sys/miscfs/fuse/fuse_device.c
===================================================================
RCS file: /var/cvs/src/sys/miscfs/fuse/fuse_device.c,v
retrieving revision 1.23
diff -u -p -r1.23 fuse_device.c
--- sys/miscfs/fuse/fuse_device.c 10 Aug 2017 14:36:34 -0000 1.23
+++ sys/miscfs/fuse/fuse_device.c 25 Oct 2017 12:18:55 -0000
@@ -92,6 +92,15 @@ fuse_dump_buff(char *buff, int len)
  char text[17];
  int i;
 
+ if (len < 0) {
+ DPRINTF("invalid len: %d", len);
+ return;
+ }
+ if (buff == NULL) {
+ DPRINTF("invalid buff");
+ return;
+ }
+
  bzero(text, 17);
  for (i = 0; i < len; i++) {
  if (i != 0 && (i % 16) == 0) {
@@ -338,7 +347,7 @@ fuseioctl(dev_t dev, u_long cmd, caddr_t
  }
 
 #ifdef FUSE_DEBUG
- fuse_dump_buff(ioexch->fbxch_data, ioexch->fbxch_len);
+ fuse_dump_buff(fbuf->fb_dat, fbuf->fb_len);
 #endif
 
  /* Adding fbuf in fd_fbufs_wait */