Hello,

clang reports (from a recent -current) a use uninitialized if doaccept
in sys/kern/uipc_syscalls.c . If isdnssocket fails resulting in goto
bad where both s and headfp have not yet been initialized, conceivably
resulting in undefined effects.

Regards

Mark

===================================================================
RCS file: /cvs/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.123
diff -u -p -r1.123 uipc_syscalls.c
--- kern/uipc_syscalls.c        1 Nov 2015 19:03:33 -0000       1.123
+++ kern/uipc_syscalls.c        8 Nov 2015 22:30:12 -0000
@@ -240,13 +240,13 @@ doaccept(struct proc *p, int sock, struc
                return (error);
        if ((error = getsock(p, sock, &fp)) != 0)
                return (error);
+       s = splsoftnet();
+       headfp = fp;
+       head = fp->f_data;
        if (isdnssocket((struct socket *)fp->f_data)) {
                error = EINVAL;
                goto bad;
        }
-       headfp = fp;
-       s = splsoftnet();
-       head = fp->f_data;
 redo:
        if ((head->so_options & SO_ACCEPTCONN) == 0) {
                error = EINVAL;

Reply via email to