polachok's projects
/
dragonfly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
565d9f6
)
soopt_from_kbuf: Use szmin(), since both len and sopt_valsize is size_t
author
Sepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 5 Sep 2009 03:52:32 +0000 (11:52 +0800)
committer
Sepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 5 Sep 2009 03:52:32 +0000 (11:52 +0800)
Mainly to avoid integer truncation on 64bit platform.
Reminded-by: dillon@
sys/kern/uipc_socket.c
patch
|
blob
|
blame
|
history
diff --git
a/sys/kern/uipc_socket.c
b/sys/kern/uipc_socket.c
index
5e724f2
..
3f91b79
100644
(file)
--- a/
sys/kern/uipc_socket.c
+++ b/
sys/kern/uipc_socket.c
@@
-1477,7
+1477,7
@@
soopt_from_kbuf(struct sockopt *sopt, const void *buf, size_t len)
* Note that this interface is not idempotent; the entire answer must
* generated ahead of time.
*/
- valsize = min(len, sopt->sopt_valsize);
+ valsize = szmin(len, sopt->sopt_valsize);
sopt->sopt_valsize = valsize;
if (sopt->sopt_val != 0) {
bcopy(buf, sopt->sopt_val, valsize);