Date: Wed, 15 Mar 2017 17:06:04 +0000 (UTC) From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315313 - stable/11/sys/compat/linux Message-ID: <201703151706.v2FH64Tp050315@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Wed Mar 15 17:06:04 2017 New Revision: 315313 URL: https://svnweb.freebsd.org/changeset/base/315313 Log: MFC r313913: Initialize cap_rights before use. MFC r313914: Style(9), some XXX comments fix. No functional changes. Modified: stable/11/sys/compat/linux/linux_socket.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_socket.c ============================================================================== --- stable/11/sys/compat/linux/linux_socket.c Wed Mar 15 16:38:39 2017 (r315312) +++ stable/11/sys/compat/linux/linux_socket.c Wed Mar 15 17:06:04 2017 (r315313) @@ -505,7 +505,7 @@ linux_sa_put(struct osockaddr *osa) * not changed. */ error = copyin(osa, &sa, sizeof(sa.sa_family)); - if (error) + if (error != 0) return (error); bdom = bsd_to_linux_domain(sa.sa_family); @@ -613,7 +613,7 @@ linux_sendit(struct thread *td, int s, s if (mp->msg_name != NULL) { error = linux_getsockaddr(&to, mp->msg_name, mp->msg_namelen); - if (error) + if (error != 0) return (error); mp->msg_name = to; } else @@ -637,7 +637,7 @@ linux_check_hdrincl(struct thread *td, i size_val = sizeof(optval); error = kern_getsockopt(td, s, IPPROTO_IP, IP_HDRINCL, &optval, UIO_SYSSPACE, &size_val); - if (error) + if (error != 0) return (error); return (optval == 0); @@ -759,7 +759,7 @@ linux_bind(struct thread *td, struct lin error = linux_getsockaddr(&sa, PTRIN(args->name), args->namelen); - if (error) + if (error != 0) return (error); error = kern_bindat(td, AT_FDCWD, args->s, sa); @@ -781,7 +781,7 @@ linux_connect(struct thread *td, struct error = linux_getsockaddr(&sa, (struct osockaddr *)PTRIN(args->name), args->namelen); - if (error) + if (error != 0) return (error); error = kern_connectat(td, AT_FDCWD, args->s, sa); @@ -842,20 +842,20 @@ linux_accept_common(struct thread *td, i int error, error1; bsd_args.s = s; - /* XXX: */ bsd_args.name = (struct sockaddr * __restrict)PTRIN(addr); - bsd_args.anamelen = PTRIN(namelen);/* XXX */ + bsd_args.anamelen = PTRIN(namelen); bsd_args.flags = 0; error = linux_set_socket_flags(flags, &bsd_args.flags); if (error != 0) return (error); error = sys_accept4(td, &bsd_args); bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name); - if (error) { + if (error != 0) { if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) return (EINVAL); if (error == EINVAL) { - error1 = getsock_cap(td, s, &rights, &fp, NULL, NULL); + error1 = getsock_cap(td, s, + cap_rights_init(&rights, CAP_ACCEPT), &fp, NULL, NULL); if (error1 != 0) return (error1); so = fp->f_data; @@ -869,7 +869,7 @@ linux_accept_common(struct thread *td, i } if (addr) error = linux_sa_put(PTRIN(addr)); - if (error) { + if (error != 0) { (void)kern_close(td, td->td_retval[0]); td->td_retval[0] = 0; } @@ -903,12 +903,11 @@ linux_getsockname(struct thread *td, str int error; bsd_args.fdes = args->s; - /* XXX: */ bsd_args.asa = (struct sockaddr * __restrict)PTRIN(args->addr); - bsd_args.alen = PTRIN(args->namelen); /* XXX */ + bsd_args.alen = PTRIN(args->namelen); error = sys_getsockname(td, &bsd_args); bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa); - if (error) + if (error != 0) return (error); return (linux_sa_put(PTRIN(args->addr))); } @@ -928,7 +927,7 @@ linux_getpeername(struct thread *td, str bsd_args.alen = (socklen_t *)PTRIN(args->namelen); error = sys_getpeername(td, &bsd_args); bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa); - if (error) + if (error != 0) return (error); return (linux_sa_put(PTRIN(args->addr))); } @@ -1425,12 +1424,12 @@ linux_recvmsg_common(struct thread *td, linux_cmsg->cmsg_len = LINUX_CMSG_LEN(datalen); error = copyout(linux_cmsg, outbuf, L_CMSG_HDRSZ); - if (error) + if (error != 0) goto bad; outbuf += L_CMSG_HDRSZ; error = copyout(data, outbuf, datalen); - if (error) + if (error != 0) goto bad; outbuf += LINUX_CMSG_ALIGN(datalen); @@ -1559,7 +1558,7 @@ linux_setsockopt(struct thread *td, stru case SO_SNDTIMEO: error = copyin(PTRIN(args->optval), &linux_tv, sizeof(linux_tv)); - if (error) + if (error != 0) return (error); tv.tv_sec = linux_tv.tv_sec; tv.tv_usec = linux_tv.tv_usec; @@ -1631,7 +1630,7 @@ linux_getsockopt(struct thread *td, stru tv_len = sizeof(tv); error = kern_getsockopt(td, args->s, bsd_args.level, name, &tv, UIO_SYSSPACE, &tv_len); - if (error) + if (error != 0) return (error); linux_tv.tv_sec = tv.tv_sec; linux_tv.tv_usec = tv.tv_usec; @@ -1645,7 +1644,7 @@ linux_getsockopt(struct thread *td, stru xulen = sizeof(xu); error = kern_getsockopt(td, args->s, bsd_args.level, name, &xu, UIO_SYSSPACE, &xulen); - if (error) + if (error != 0) return (error); /* * XXX Use 0 for pid as the FreeBSD does not cache peer pid. @@ -1660,7 +1659,7 @@ linux_getsockopt(struct thread *td, stru len = sizeof(newval); error = kern_getsockopt(td, args->s, bsd_args.level, name, &newval, UIO_SYSSPACE, &len); - if (error) + if (error != 0) return (error); newval = -SV_ABI_ERRNO(td->td_proc, newval); return (copyout(&newval, PTRIN(args->optval), len));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703151706.v2FH64Tp050315>