git: 26389b308d97 - main - soreceive_dgram: assert that a datagram has control or data

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Sat, 23 Mar 2024 05:45:43 UTC
The branch main has been updated by glebius:

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

commit 26389b308d97f90a1c196a85666142965bf0737c
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-03-23 05:44:16 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-03-23 05:44:16 +0000

    soreceive_dgram: assert that a datagram has control or data
---
 sys/kern/uipc_socket.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 9a29df8b0340..b70864cbf2a4 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -2872,10 +2872,7 @@ soreceive_dgram(struct socket *so, struct sockaddr **psa, struct uio *uio,
 			    M_NOWAIT);
 		m = m_free(m);
 	}
-	if (m == NULL) {
-		/* XXXRW: Can this happen? */
-		return (0);
-	}
+	KASSERT(m, ("%s: no data or control after soname", __func__));
 
 	/*
 	 * Packet to copyout() is now in 'm' and it is disconnected from the