From nobody Fri Jun 17 19:39:13 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1B39585BF87; Fri, 17 Jun 2022 19:39:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPq9Z2F08z3QpS; Fri, 17 Jun 2022 19:39:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RNgt7l1LRhlwfLeiw7YXJ8ke2RfyXJ0L7rbVO5JiB4Y=; b=L7Ukb2XCLC+plKF+6aRo9VtiAt8BW1VDFHBS9R/pxXYoOrK2thkRfkllAxEKTzYnYUde9L qVogy9a6bqRMwy/R5/8wfoAW3NFfMe9lNOohzdXzN6b22/JakmFjST/7saNPkBKCH0nhHn F1Kz8mkv1BjFWVS5v4tH6TJ5jME3GLiMFh8Yh0o8zt0VPX4XDCmCZ0ls3h3o1Jf4OxvW4A IANe8jqfxkNK+TiRfndeHgODE4NSk5NvVKOwxVHEfRNa33eF7bqQoZx+F0MebvclBflj6p 5tdZ0SXrWhi3FikU7CIso2ltOAT16m0GMVuT2i50MSVi/p6rYDoF4VA9wKli6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE70B25AD3; Fri, 17 Jun 2022 19:39:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJdDZY015733; Fri, 17 Jun 2022 19:39:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJdDsX015732; Fri, 17 Jun 2022 19:39:13 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:39:13 GMT Message-Id: <202206171939.25HJdDsX015732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: cadaecc91e97 - stable/13 - linux(4): Microoptimize bsd_to_linux_sockaddr(). List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cadaecc91e971795c57b26591b141d7749191309 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RNgt7l1LRhlwfLeiw7YXJ8ke2RfyXJ0L7rbVO5JiB4Y=; b=B1KjJzA6jLONYKFDMfklTeyHxTFoMuVbZiGUQzVakWP1oCRxmFJzeZrNuMs/9svjMlLZdy JlJ1S2Sf9z6B7VXu8GglUJ1oj8UuMGN2K0SdIgW+tSOwbK9Ycnhy288VOq6zWVYsoj1Mes FiRLGL7VvkA4UzYGGh1Ny6ASG/hOdMNGjbt/+NWSiBtzlrDo/b4oECZET96Vsuo+XKMmdk uTwAohbmZBXkgR0qc5zShbfSX7W9dNTUaQPzwL4YklZ4G824OhTrm8iXTuzNsPtLmPlpvC Lu1/7Oiy8JYdRZoT8mJTbWnA+Pm3D6KanlIWqaTkwtBzIQpfbtYHvhOd3FsmAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494754; a=rsa-sha256; cv=none; b=Y7pZtQLXM89JoSXbWqPKDKb4OawTOvlOOQi2YTScpcFYb593tHb2z20ahKNwwnlJbEUk4o +mkI0MhecKqj3Zeo4NfnkyUHCyvgJGWCQcbQiXJhcUlMvODB1IbkvueJ8OZ4KfV3mGL9dq CkZJs7IrG6B7SH64WJWioi+pNLtBESbyhfCxEqU4apb5PeC+MxH345+kGBk2VzJZqknNbH RFLml2mCSViasMrzFTEE3UN6xnSj+Kv5N7wQ+OvyoztSHORqepY6Gp6QrQfMUVYOa4knPJ dqWpW1AMie8WO2x13yFKzq04YTqN0LHXjIMgaevCpOgTdUluUM5HsEuaL90Zcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=cadaecc91e971795c57b26591b141d7749191309 commit cadaecc91e971795c57b26591b141d7749191309 Author: Dmitry Chagin AuthorDate: 2022-04-25 07:21:20 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:33:54 +0000 linux(4): Microoptimize bsd_to_linux_sockaddr(). Differential Revision: https://reviews.freebsd.org/D34725 MFC after: 2 weeks (cherry picked from commit bbddd5881d1826a366d09d1e156ec6b64d3715e5) --- 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 8cc678e1ec7d..414edc2446bd 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