From bd80f1c775dca096a5f3c26dd8856d845116b278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 7 Sep 2004 15:39:03 +0000 Subject: [PATCH] Now handles NULL cookies for the VM fs calls gracefully (in case someone would want to mmap() a device directly). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8884 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/fs/devfs.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kernel/core/fs/devfs.cpp b/src/kernel/core/fs/devfs.cpp index bb2c151003..f0c7c170e7 100644 --- a/src/kernel/core/fs/devfs.cpp +++ b/src/kernel/core/fs/devfs.cpp @@ -1068,7 +1068,8 @@ devfs_can_page(fs_volume _fs, fs_vnode _vnode, fs_cookie cookie) TRACE(("devfs_canpage: vnode %p\n", vnode)); if (vnode->stream.type != STREAM_TYPE_DEVICE - || vnode->stream.u.dev.node == NULL) + || vnode->stream.u.dev.node == NULL + || cookie == NULL) return false; return vnode->stream.u.dev.info->read_pages != NULL; @@ -1084,7 +1085,8 @@ devfs_read_pages(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, off_t pos, c TRACE(("devfs_read_pages: vnode %p, vecs %p, count = %lu, pos = %Ld, size = %lu\n", vnode, vecs, count, pos, *_numBytes)); if (vnode->stream.type != STREAM_TYPE_DEVICE - || vnode->stream.u.dev.info->read_pages == NULL) + || vnode->stream.u.dev.info->read_pages == NULL + || cookie == NULL) return B_NOT_ALLOWED; if (vnode->stream.u.dev.part_map) @@ -1103,7 +1105,8 @@ devfs_write_pages(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, off_t pos, TRACE(("devfs_write_pages: vnode %p, vecs %p, count = %lu, pos = %Ld, size = %lu\n", vnode, vecs, count, pos, *_numBytes)); if (vnode->stream.type != STREAM_TYPE_DEVICE - || vnode->stream.u.dev.info->write_pages == NULL) + || vnode->stream.u.dev.info->write_pages == NULL + || cookie == NULL) return B_NOT_ALLOWED; if (vnode->stream.u.dev.part_map)