git: a21238d843eb - main - linux(4): Improve readability of recvmsg control buffer copyout code

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Mon, 14 Aug 2023 12:47:16 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=a21238d843ebe02e696cdc30b008382dfca5612e

commit a21238d843ebe02e696cdc30b008382dfca5612e
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-08-14 12:46:12 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-08-14 12:46:12 +0000

    linux(4): Improve readability of recvmsg control buffer copyout code
    
    MFC after:      1 week
---
 sys/compat/linux/linux_socket.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 791f59aaf552..1acd93122b8f 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1866,10 +1866,9 @@ cont:
 		lcm->cmsg_len = LINUX_CMSG_LEN(datalen);
 		error = copyout(lcm, outbuf, L_CMSG_HDRSZ);
 		if (error == 0) {
-			outbuf += L_CMSG_HDRSZ;
-			error = copyout(data, outbuf, datalen);
+			error = copyout(data, LINUX_CMSG_DATA(outbuf), datalen);
 			if (error == 0) {
-				outbuf += LINUX_CMSG_ALIGN(datalen);
+				outbuf += LINUX_CMSG_SPACE(datalen);
 				outlen += LINUX_CMSG_SPACE(datalen);
 			}
 		}