From 1fae578f00fafd130693a60c95f129cccab5f302 Mon Sep 17 00:00:00 2001 From: helg Date: Mon, 22 Jan 2018 13:16:49 +0000 Subject: Use the proper address space when using a kernel that supports Supervisor Mode Access Prevention (SMAP) compiled with FUSE_DEBUG. While here, add some sanity check to the debug function fuse_dump_buff. Thanks to Thomas Jeunet. OK mpi@, helg@ --- sys/miscfs/fuse/fuse_device.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sys/miscfs/fuse') diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c index 37598169b37..5bbde357c98 100644 --- a/sys/miscfs/fuse/fuse_device.c +++ b/sys/miscfs/fuse/fuse_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_device.c,v 1.23 2017/08/10 14:36:34 mestre Exp $ */ +/* $OpenBSD: fuse_device.c,v 1.24 2018/01/22 13:16:48 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -92,6 +92,15 @@ fuse_dump_buff(char *buff, int len) char text[17]; int i; + if (len < 0) { + printf("invalid len: %d", len); + return; + } + if (buff == NULL) { + printf("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 addr, int flags, struct proc *p) } #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 */ -- cgit v1.2.3