Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpvfs Don't try to kmem_alloc() 0 bytes. ...
details: https://anonhg.NetBSD.org/src/rev/c1ea6626400e
branches: trunk
changeset: 763615:c1ea6626400e
user: riz <riz%NetBSD.org@localhost>
date: Sun Mar 27 21:16:52 2011 +0000
description:
Don't try to kmem_alloc() 0 bytes. Without this change, some trivial
kernel modules were not loadable by rump_server.
diffstat:
sys/rump/librump/rumpvfs/rumpfs.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r 3b402f96cd7f -r c1ea6626400e sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Sun Mar 27 19:47:46 2011 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Sun Mar 27 21:16:52 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.93 2011/03/21 16:41:09 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.94 2011/03/27 21:16:52 riz Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.93 2011/03/21 16:41:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.94 2011/03/27 21:16:52 riz Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -1219,6 +1219,8 @@
int error = 0;
bufsize = uio->uio_resid;
+ if (bufsize == 0)
+ return 0;
buf = kmem_alloc(bufsize, KM_SLEEP);
if ((n = rumpuser_pread(rn->rn_readfd, buf, bufsize,
uio->uio_offset + rn->rn_offset, &error)) == -1)
@@ -1275,6 +1277,8 @@
int error = 0;
bufsize = uio->uio_resid;
+ if (bufsize == 0)
+ return 0;
buf = kmem_alloc(bufsize, KM_SLEEP);
error = uiomove(buf, bufsize, uio);
if (error)
Home |
Main Index |
Thread Index |
Old Index