Module Name: src Committed By: christos Date: Tue Jun 20 20:34:49 UTC 2017
Modified Files: src/sys/kern: uipc_syscalls.c Log Message: Change len type to be unsigned int for consistency with the input type. Don't check for negative; it does not matter we clamp anyway. This broke the compat32 getsockname() where an unitialized socklen_t ended up randomly negative causing it to fail. To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.187 src/sys/kern/uipc_syscalls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/uipc_syscalls.c diff -u src/sys/kern/uipc_syscalls.c:1.186 src/sys/kern/uipc_syscalls.c:1.187 --- src/sys/kern/uipc_syscalls.c:1.186 Fri Feb 3 11:06:45 2017 +++ src/sys/kern/uipc_syscalls.c Tue Jun 20 16:34:49 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls.c,v 1.186 2017/02/03 16:06:45 christos Exp $ */ +/* $NetBSD: uipc_syscalls.c,v 1.187 2017/06/20 20:34:49 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.186 2017/02/03 16:06:45 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.187 2017/06/20 20:34:49 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_pipe.h" @@ -1362,7 +1362,7 @@ int copyout_sockname_sb(struct sockaddr *asa, unsigned int *alen, int flags, struct sockaddr_big *addr) { - int len; + unsigned int len; int error; if (asa == NULL) @@ -1375,8 +1375,6 @@ copyout_sockname_sb(struct sockaddr *asa return error; } else len = *alen; - if (len < 0) - return EINVAL; if (addr == NULL) { len = 0;