git: bbddd5881d18 - main - linux(4): Microoptimize bsd_to_linux_sockaddr().
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Apr 2022 07:23:42 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bbddd5881d1826a366d09d1e156ec6b64d3715e5 commit bbddd5881d1826a366d09d1e156ec6b64d3715e5 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-04-25 07:21:20 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-04-25 07:21:20 +0000 linux(4): Microoptimize bsd_to_linux_sockaddr(). Differential Revision: https://reviews.freebsd.org/D34725 MFC after: 2 weeks --- sys/compat/linux/linux.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index 81ceb964662f..2de5d9ca1911 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -400,28 +400,20 @@ bsd_to_linux_sockaddr(const struct sockaddr *sa, struct l_sockaddr **lsa, socklen_t len) { struct l_sockaddr *kosa; - int error, bdom; + int bdom; *lsa = NULL; if (len < 2 || len > UCHAR_MAX) return (EINVAL); + bdom = bsd_to_linux_domain(sa->sa_family); + if (bdom == -1) + return (EAFNOSUPPORT); kosa = malloc(len, M_SONAME, M_WAITOK); bcopy(sa, kosa, len); - - bdom = bsd_to_linux_domain(sa->sa_family); - if (bdom == -1) { - error = EAFNOSUPPORT; - goto out; - } - kosa->sa_family = bdom; *lsa = kosa; return (0); - -out: - free(kosa, M_SONAME); - return (error); } int