From nobody Sat Jul 29 08:22:51 2023 X-Original-To: dev-commits-src-all@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 4RCcvK0m3sz4pKHj; Sat, 29 Jul 2023 08:22:53 +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 4RCcvJ3sj3z3rM6; Sat, 29 Jul 2023 08:22:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690618972; 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=0wDIbq8Ykotp3H1VYqAspHUZbShWUDwVomlvVFb2n/E=; b=Fu5HabTJVanwJPD78VC8njDQHT9AvF2wRgW1qmjAYLKeZMzIg/WiUFtajEpcBpXRbV8Lci xHqDGCboVUIF+zIjsk5iOLgWcMVrtkGJMSd65/BNsg8qYuDJ7UMEUNWHkhaF0xY3QyBTmb oqJ8XTb9OFZSX7pndgQP01RLdEd4zfigudlmkJRbPBJbOb6amqocjn61c2SgDcAtJQfgua 28Xbc+93N7gJHgpsIJhnMffzFYQHLihdmrqRL0rJXJNKWogcZGJcaiippjC/AQrdRSpzPr /NPxKvWl0MsrCyvwKiNLugXbO/sQRbTzAvOTTUQWan3H2vprclNezyT4doLIWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690618972; 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=0wDIbq8Ykotp3H1VYqAspHUZbShWUDwVomlvVFb2n/E=; b=yVHJmEVCGx2BIvQnJEZZVn5ZUAlIupvc1nvKuej0rKptUiaMHX9n1EEM8HlysTrAsAKvFF 9V9Z4BaKCuIyJNhkg0qBubWKZeSF5EeEvlz/bzueNzrBU1W7bllVFgA1xPmdKQMhVQHqGG v0hf4daVRLMx+rt9WcFujXxVYpom+RcGVcZfyco+hnTIEtf2swyTvLn79pZ8dSGqRlEmWG woZ/fGR8hA5EDnce/Y319z00h3Ajn+0XsEKm8095LNo0nxaJPIo5sOwiIgstDMxMJ/yuyk 90Kg8M/SetTpxnFB9NgWV0jJAwMG3fvzoFF2v0HAXJMlpnEWK/Cwb5fBP+CrGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690618972; a=rsa-sha256; cv=none; b=vVFPKukON0yFWDwqH6SAoFl4oURKNmjYiO78wSCN1aJYReAJmDXOsFXCI7WryV8y3tRW+J KttdPklPIMwLVaYIT7ghl4LI6+q10p1+89sTeAjNHpwpFc+tOjSB8tiSolrvSQpWAWDbRy 7toqr4GFOUu7EmnzymCHSYJR9lzKLlpBTwVf7St9HvZOQsn38qSOsMVLywPQFIzmYi4V+4 sl4n21j1XFCmlEXTiw5p4jtfnxGX0dBvNjdJwBT90sMCsiC2g7WDBptA3MmgscxgRwYC1o bYwkhmrqUDgp7Hfsdbetdxp7f5x20WSGRFPMSbS2pw6eImHfwP8flNUXayBhPQ== 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 4RCcvJ06mDzQsg; Sat, 29 Jul 2023 08:22:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36T8MpTc082406; Sat, 29 Jul 2023 08:22:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36T8Mpfa082405; Sat, 29 Jul 2023 08:22:51 GMT (envelope-from git) Date: Sat, 29 Jul 2023 08:22:51 GMT Message-Id: <202307290822.36T8Mpfa082405@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 67116c69052d - main - linux(4): Fix control message size calculation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 67116c69052d27dbd6d6c066104850d4d53f0041 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=67116c69052d27dbd6d6c066104850d4d53f0041 commit 67116c69052d27dbd6d6c066104850d4d53f0041 Author: Dmitry Chagin AuthorDate: 2023-07-29 08:21:35 +0000 Commit: Dmitry Chagin CommitDate: 2023-07-29 08:21:35 +0000 linux(4): Fix control message size calculation To determine the size in bytes needed to hold a control message and its contents of length len, CMSG_SPACE should be used. Reviewed by: Differential Revision: https://reviews.freebsd.org/D41224 MFC after: 1 week --- sys/compat/linux/linux_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index dd8d688a6916..ac411aae1cb3 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1852,7 +1852,7 @@ cont: if (error != 0) goto bad; - if (outlen + LINUX_CMSG_LEN(datalen) > maxlen) { + if (outlen + LINUX_CMSG_SPACE(datalen) > maxlen) { if (outlen == 0) { error = EMSGSIZE; goto err; @@ -1871,7 +1871,7 @@ cont: error = copyout(data, outbuf, datalen); if (error == 0) { outbuf += LINUX_CMSG_ALIGN(datalen); - outlen += LINUX_CMSG_LEN(datalen); + outlen += LINUX_CMSG_SPACE(datalen); } } err: