Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Change len type to be unsigned int for consistency ...



details:   https://anonhg.NetBSD.org/src/rev/b74118ae73ca
branches:  trunk
changeset: 824852:b74118ae73ca
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 20 20:34:49 2017 +0000

description:
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.

diffstat:

 sys/kern/uipc_syscalls.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r d8ed52d1453d -r b74118ae73ca sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Tue Jun 20 20:20:02 2017 +0000
+++ b/sys/kern/uipc_syscalls.c  Tue Jun 20 20:34:49 2017 +0000
@@ -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 @@
 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 @@
                        return error;
        } else
                len = *alen;
-       if (len < 0)
-               return EINVAL;
 
        if (addr == NULL) {
                len = 0;



Home | Main Index | Thread Index | Old Index