polachok's projects
/
dragonfly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
d850923
)
sockopt: Short circuit most of the code in soopt_from_kbuf(), if len == 0
author
Sepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 5 Sep 2009 03:27:25 +0000 (11:27 +0800)
committer
Sepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 5 Sep 2009 03:27:25 +0000 (11:27 +0800)
Current kva_p() does not work w/ zero sized kmalloced memory.
Dragonfly-bug: http://bugs.dragonflybsd.org/issue1481
sys/kern/uipc_socket.c
patch
|
blob
|
blame
|
history
diff --git
a/sys/kern/uipc_socket.c
b/sys/kern/uipc_socket.c
index
e6f2ca2
..
5e724f2
100644
(file)
--- a/
sys/kern/uipc_socket.c
+++ b/
sys/kern/uipc_socket.c
@@
-1460,6
+1460,11
@@
soopt_from_kbuf(struct sockopt *sopt, const void *buf, size_t len)
{
size_t valsize;
+ if (len == 0) {
+ sopt->sopt_valsize = 0;
+ return;
+ }
+
KKASSERT(!sopt->sopt_val || kva_p(sopt->sopt_val));
KKASSERT(kva_p(buf));