From e07b819e70b5ce92a5d289d17728b9579aee8d86 Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 30 Aug 2023 14:46:41 +0800 Subject: [PATCH] mm/alloc: remove all unnecessary check for psock/conn Since inet/socket layer already contains sanity checks, so remove unnecessary lower half checks Signed-off-by: chao an --- net/bluetooth/bluetooth_sendmsg.c | 3 --- net/bluetooth/bluetooth_sockif.c | 13 +------------ net/can/can_getsockopt.c | 3 +-- net/can/can_recvmsg.c | 2 -- net/can/can_setsockopt.c | 1 - net/can/can_sockif.c | 5 +---- net/icmp/icmp_netpoll.c | 1 - net/icmp/icmp_recvmsg.c | 3 +-- net/icmp/icmp_sendmsg.c | 2 +- net/icmp/icmp_sockif.c | 3 --- net/icmpv6/icmpv6_netpoll.c | 1 - net/icmpv6/icmpv6_recvmsg.c | 3 +-- net/icmpv6/icmpv6_sendmsg.c | 2 +- net/icmpv6/icmpv6_sockif.c | 3 --- net/ieee802154/ieee802154_sendmsg.c | 4 ---- net/ieee802154/ieee802154_sockif.c | 13 +------------ net/local/local_accept.c | 1 - net/local/local_bind.c | 2 +- net/local/local_connect.c | 1 - net/local/local_recvmsg.c | 2 +- net/local/local_sendmsg.c | 2 +- net/local/local_sockif.c | 10 +++++----- net/netlink/netlink_sockif.c | 15 ++++++--------- net/pkt/pkt_sockif.c | 2 +- net/sixlowpan/sixlowpan_tcpsend.c | 3 --- net/sixlowpan/sixlowpan_udpsend.c | 3 +-- net/tcp/tcp_accept.c | 2 -- net/tcp/tcp_close.c | 1 - net/tcp/tcp_getsockopt.c | 3 +-- net/tcp/tcp_monitor.c | 3 --- net/tcp/tcp_setsockopt.c | 1 - net/tcp/tcp_txdrain.c | 1 - net/udp/udp_sendto_buffered.c | 1 - net/udp/udp_sendto_unbuffered.c | 1 - net/udp/udp_txdrain.c | 1 - net/usrsock/usrsock_accept.c | 2 -- net/usrsock/usrsock_bind.c | 2 -- net/usrsock/usrsock_connect.c | 2 -- net/usrsock/usrsock_listen.c | 2 -- net/usrsock/usrsock_recvmsg.c | 2 -- net/usrsock/usrsock_sendmsg.c | 2 -- net/usrsock/usrsock_setsockopt.c | 2 -- net/usrsock/usrsock_sockif.c | 2 -- 43 files changed, 25 insertions(+), 108 deletions(-) diff --git a/net/bluetooth/bluetooth_sendmsg.c b/net/bluetooth/bluetooth_sendmsg.c index cbcf66dceaf73..d52b79129a4bc 100644 --- a/net/bluetooth/bluetooth_sendmsg.c +++ b/net/bluetooth/bluetooth_sendmsg.c @@ -417,7 +417,6 @@ static ssize_t bluetooth_l2cap_send(FAR struct socket *psock, ssize_t ret; conn = psock->s_conn; - DEBUGASSERT(conn != NULL); if (!_SS_ISCONNECTED(conn->bc_conn.s_flags)) { @@ -491,8 +490,6 @@ static ssize_t bluetooth_send(FAR struct socket *psock, FAR const void *buf, { ssize_t ret; - DEBUGASSERT(psock != NULL || buf != NULL); - /* Only SOCK_RAW is supported */ if (psock->s_type == SOCK_RAW) diff --git a/net/bluetooth/bluetooth_sockif.c b/net/bluetooth/bluetooth_sockif.c index ff3a50ba47a7a..4d239248d3861 100644 --- a/net/bluetooth/bluetooth_sockif.c +++ b/net/bluetooth/bluetooth_sockif.c @@ -208,8 +208,7 @@ static void bluetooth_addref(FAR struct socket *psock) { FAR struct bluetooth_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && - (psock->s_type == SOCK_RAW || psock->s_type == SOCK_CTRL)); + DEBUGASSERT(psock->s_type == SOCK_RAW || psock->s_type == SOCK_CTRL); conn = psock->s_conn; DEBUGASSERT(conn->bc_crefs > 0 && conn->bc_crefs < 255); @@ -250,9 +249,7 @@ static int bluetooth_connect(FAR struct socket *psock, FAR struct sockaddr_l2 *btaddr; int ret = OK; - DEBUGASSERT(psock != NULL || addr != NULL); conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Verify the address family */ @@ -308,8 +305,6 @@ static int bluetooth_connect(FAR struct socket *psock, static int bluetooth_bind(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen) { - DEBUGASSERT(psock != NULL && addr != NULL); - /* Verify that a valid address has been provided */ if (addr->sa_family != AF_BLUETOOTH) @@ -521,10 +516,7 @@ static int bluetooth_getsockname(FAR struct socket *psock, FAR struct sockaddr_l2 tmp; socklen_t copylen; - DEBUGASSERT(psock != NULL && addr != NULL && addrlen != NULL); - conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Create a copy of the full address on the stack */ @@ -583,15 +575,12 @@ static int bluetooth_getpeername(FAR struct socket *psock, FAR struct sockaddr_l2 tmp; socklen_t copylen; - DEBUGASSERT(psock != NULL && addr != NULL && addrlen != NULL); - if (psock->s_proto != BTPROTO_L2CAP) { return -EPFNOSUPPORT; } conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Create a copy of the full address on the stack */ diff --git a/net/can/can_getsockopt.c b/net/can/can_getsockopt.c index 74931a093828f..744c5b4c1fcd3 100644 --- a/net/can/can_getsockopt.c +++ b/net/can/can_getsockopt.c @@ -80,8 +80,7 @@ int can_getsockopt(FAR struct socket *psock, int level, int option, FAR struct can_conn_s *conn; int ret = OK; - DEBUGASSERT(psock != NULL && value != NULL && value_len != NULL && - psock->s_conn != NULL); + DEBUGASSERT(value != NULL && value_len != NULL); conn = psock->s_conn; #ifdef CONFIG_NET_TIMESTAMP diff --git a/net/can/can_recvmsg.c b/net/can/can_recvmsg.c index 66639d42eee22..d347dac4a629e 100644 --- a/net/can/can_recvmsg.c +++ b/net/can/can_recvmsg.c @@ -473,8 +473,6 @@ ssize_t can_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, struct can_recvfrom_s state; int ret; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); - conn = psock->s_conn; if (psock->s_type != SOCK_RAW) diff --git a/net/can/can_setsockopt.c b/net/can/can_setsockopt.c index 1216588785645..8716dcf491f1f 100644 --- a/net/can/can_setsockopt.c +++ b/net/can/can_setsockopt.c @@ -77,7 +77,6 @@ int can_setsockopt(FAR struct socket *psock, int level, int option, int ret = OK; int count = 0; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); DEBUGASSERT(value_len == 0 || value != NULL); conn = psock->s_conn; diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c index fc47eedc97409..5f8f7d6b11056 100644 --- a/net/can/can_sockif.c +++ b/net/can/can_sockif.c @@ -270,8 +270,6 @@ static void can_addref(FAR struct socket *psock) { FAR struct can_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); - conn = psock->s_conn; DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255); conn->crefs++; @@ -312,7 +310,7 @@ static int can_bind(FAR struct socket *psock, { FAR struct sockaddr_can *canaddr; FAR struct can_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && addr != NULL && + DEBUGASSERT(addr != NULL && addrlen >= sizeof(struct sockaddr_can)); /* Save the address information in the connection structure */ @@ -365,7 +363,6 @@ static int can_poll_local(FAR struct socket *psock, FAR struct pollfd *fds, pollevent_t eventset = 0; int ret = OK; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; info = conn->pollinfo; diff --git a/net/icmp/icmp_netpoll.c b/net/icmp/icmp_netpoll.c index 0fb4f611dff65..e5cf3df4e7731 100644 --- a/net/icmp/icmp_netpoll.c +++ b/net/icmp/icmp_netpoll.c @@ -84,7 +84,6 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev, */ psock = info->psock; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; if (dev != conn->dev) { diff --git a/net/icmp/icmp_recvmsg.c b/net/icmp/icmp_recvmsg.c index 359c9c562fb29..f629ea62d2f3d 100644 --- a/net/icmp/icmp_recvmsg.c +++ b/net/icmp/icmp_recvmsg.c @@ -104,7 +104,6 @@ static uint16_t recvfrom_eventhandler(FAR struct net_driver_s *dev, } psock = pstate->recv_sock; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); /* Check if we have just received a ICMP ECHO reply. */ @@ -295,7 +294,7 @@ ssize_t icmp_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, /* Some sanity checks */ - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && buf != NULL); + DEBUGASSERT(buf != NULL); if (len < ICMP_HDRLEN) { diff --git a/net/icmp/icmp_sendmsg.c b/net/icmp/icmp_sendmsg.c index 4d767a8c74bac..a9f74867ec52c 100644 --- a/net/icmp/icmp_sendmsg.c +++ b/net/icmp/icmp_sendmsg.c @@ -290,7 +290,7 @@ ssize_t icmp_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg, /* Some sanity checks */ - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( buf != NULL && to != NULL); if (len < ICMP_HDRLEN || tolen < sizeof(struct sockaddr_in)) diff --git a/net/icmp/icmp_sockif.c b/net/icmp/icmp_sockif.c index ae16cec664e62..75b39eb734a25 100644 --- a/net/icmp/icmp_sockif.c +++ b/net/icmp/icmp_sockif.c @@ -190,8 +190,6 @@ static void icmp_addref(FAR struct socket *psock) { FAR struct icmp_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); - conn = psock->s_conn; DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255); conn->crefs++; @@ -254,7 +252,6 @@ static int icmp_close(FAR struct socket *psock) { FAR struct icmp_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; /* Is this the last reference to the connection structure (there could be\ diff --git a/net/icmpv6/icmpv6_netpoll.c b/net/icmpv6/icmpv6_netpoll.c index e46e0ecaa2469..eee9ca6e23506 100644 --- a/net/icmpv6/icmpv6_netpoll.c +++ b/net/icmpv6/icmpv6_netpoll.c @@ -84,7 +84,6 @@ static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev, */ psock = info->psock; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; if (dev != conn->dev) { diff --git a/net/icmpv6/icmpv6_recvmsg.c b/net/icmpv6/icmpv6_recvmsg.c index 56e02bd3aa027..afd10a02e5ccd 100644 --- a/net/icmpv6/icmpv6_recvmsg.c +++ b/net/icmpv6/icmpv6_recvmsg.c @@ -113,7 +113,6 @@ static uint16_t recvfrom_eventhandler(FAR struct net_driver_s *dev, } psock = pstate->recv_sock; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); /* Check if we have just received a ICMPv6 message. */ @@ -309,7 +308,7 @@ ssize_t icmpv6_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, /* Some sanity checks */ - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && buf != NULL); + DEBUGASSERT(buf != NULL); if (len < ICMPv6_HDRLEN) { diff --git a/net/icmpv6/icmpv6_sendmsg.c b/net/icmpv6/icmpv6_sendmsg.c index 13ccc2b938bc6..05b7b419769fe 100644 --- a/net/icmpv6/icmpv6_sendmsg.c +++ b/net/icmpv6/icmpv6_sendmsg.c @@ -286,7 +286,7 @@ ssize_t icmpv6_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg, /* Some sanity checks */ - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( buf != NULL && to != NULL); if (len < ICMPv6_HDRLEN || tolen < sizeof(struct sockaddr_in6)) diff --git a/net/icmpv6/icmpv6_sockif.c b/net/icmpv6/icmpv6_sockif.c index e1f95f9d4bd9f..9153fcc6a603d 100644 --- a/net/icmpv6/icmpv6_sockif.c +++ b/net/icmpv6/icmpv6_sockif.c @@ -191,8 +191,6 @@ static void icmpv6_addref(FAR struct socket *psock) { FAR struct icmpv6_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); - conn = psock->s_conn; DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255); conn->crefs++; @@ -255,7 +253,6 @@ static int icmpv6_close(FAR struct socket *psock) { FAR struct icmpv6_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; /* Is this the last reference to the connection structure (there could be\ diff --git a/net/ieee802154/ieee802154_sendmsg.c b/net/ieee802154/ieee802154_sendmsg.c index d3d11c725ad70..2bdf63c1185e5 100644 --- a/net/ieee802154/ieee802154_sendmsg.c +++ b/net/ieee802154/ieee802154_sendmsg.c @@ -176,8 +176,6 @@ static void ieee802154_meta_data(FAR struct radio_driver_s *radio, meta != NULL); psock = pstate->is_sock; - DEBUGASSERT(psock->s_conn != NULL); - conn = psock->s_conn; srcaddr = &conn->laddr; destaddr = &pstate->is_destaddr; @@ -565,9 +563,7 @@ static ssize_t ieee802154_send(FAR struct socket *psock, FAR const void *buf, FAR struct ieee802154_conn_s *conn; ssize_t ret; - DEBUGASSERT(psock != NULL || buf != NULL); conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Only SOCK_DGRAM is supported (because the MAC header is stripped) */ diff --git a/net/ieee802154/ieee802154_sockif.c b/net/ieee802154/ieee802154_sockif.c index 6078172e5d000..62120622607bf 100644 --- a/net/ieee802154/ieee802154_sockif.c +++ b/net/ieee802154/ieee802154_sockif.c @@ -199,8 +199,7 @@ static void ieee802154_addref(FAR struct socket *psock) { FAR struct ieee802154_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && - (psock->s_type == SOCK_DGRAM || psock->s_type == SOCK_CTRL)); + DEBUGASSERT(psock->s_type == SOCK_DGRAM || psock->s_type == SOCK_CTRL); conn = psock->s_conn; DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255); @@ -247,9 +246,7 @@ static int ieee802154_connect(FAR struct socket *psock, FAR struct sockaddr_ieee802154_s *ieeeaddr; int ret = OK; - DEBUGASSERT(psock != NULL || addr != NULL); conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Verify the address family */ @@ -302,8 +299,6 @@ static int ieee802154_bind(FAR struct socket *psock, FAR struct ieee802154_conn_s *conn; FAR struct radio_driver_s *radio; - DEBUGASSERT(psock != NULL && addr != NULL); - /* Verify that a valid address has been provided */ if (addr->sa_family != AF_IEEE802154 || @@ -400,10 +395,7 @@ static int ieee802154_getsockname(FAR struct socket *psock, FAR struct sockaddr_ieee802154_s tmp; socklen_t copylen; - DEBUGASSERT(psock != NULL && addr != NULL && addrlen != NULL); - conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Create a copy of the full address on the stack */ @@ -462,10 +454,7 @@ static int ieee802154_getpeername(FAR struct socket *psock, FAR struct sockaddr_ieee802154_s tmp; socklen_t copylen; - DEBUGASSERT(psock != NULL && addr != NULL && addrlen != NULL); - conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Create a copy of the full address on the stack */ diff --git a/net/local/local_accept.c b/net/local/local_accept.c index 4b82c0cf4cbfb..df727a34d205e 100644 --- a/net/local/local_accept.c +++ b/net/local/local_accept.c @@ -108,7 +108,6 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr, /* Some sanity checks */ - DEBUGASSERT(psock && psock->s_conn); DEBUGASSERT(newsock && !newsock->s_conn); /* Is the socket a stream? */ diff --git a/net/local/local_bind.c b/net/local/local_bind.c index a664c0b843633..21fb28782b9c9 100644 --- a/net/local/local_bind.c +++ b/net/local/local_bind.c @@ -53,7 +53,7 @@ int psock_local_bind(FAR struct socket *psock, FAR const struct sockaddr_un *unaddr = (FAR const struct sockaddr_un *)addr; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( unaddr != NULL && unaddr->sun_family == AF_LOCAL); if (addrlen <= sizeof(sa_family_t) + 1) diff --git a/net/local/local_connect.c b/net/local/local_connect.c index 9ace340c3bf03..265856cc30f62 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -245,7 +245,6 @@ int psock_local_connect(FAR struct socket *psock, struct stat buf; int ret; - DEBUGASSERT(psock && psock->s_conn); client = psock->s_conn; if (client->lc_state == LOCAL_STATE_ACCEPT || diff --git a/net/local/local_recvmsg.c b/net/local/local_recvmsg.c index 0e7b276ee8dc3..57ac3bcf7c4bc 100644 --- a/net/local/local_recvmsg.c +++ b/net/local/local_recvmsg.c @@ -509,7 +509,7 @@ ssize_t local_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, FAR void *buf = msg->msg_iov->iov_base; size_t len = msg->msg_iov->iov_len; - DEBUGASSERT(psock && psock->s_conn && buf); + DEBUGASSERT(buf); /* Check for a stream socket */ diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c index 9ab07f40068ee..40c1d6c016e74 100644 --- a/net/local/local_sendmsg.c +++ b/net/local/local_sendmsg.c @@ -179,7 +179,7 @@ static ssize_t local_send(FAR struct socket *psock, /* Local TCP packet send */ - DEBUGASSERT(psock && psock->s_conn && buf); + DEBUGASSERT(buf); peer = psock->s_conn; /* Verify that this is a connected peer socket and that it has diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index cc6c21a71f58c..8ba81d1a0bb7e 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -261,7 +261,7 @@ static void local_addref(FAR struct socket *psock) { FAR struct local_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( psock->s_domain == PF_LOCAL); conn = psock->s_conn; @@ -368,7 +368,7 @@ static int local_getsockname(FAR struct socket *psock, FAR struct sockaddr_un *unaddr = (FAR struct sockaddr_un *)addr; FAR struct local_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( unaddr != NULL && addrlen != NULL); if (*addrlen < sizeof(sa_family_t)) @@ -467,7 +467,7 @@ static int local_getpeername(FAR struct socket *psock, FAR struct local_conn_s *conn; FAR struct local_conn_s *peer; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( unaddr != NULL && addrlen != NULL); if (*addrlen < sizeof(sa_family_t)) @@ -573,7 +573,7 @@ static int local_getpeername(FAR struct socket *psock, static int local_getsockopt(FAR struct socket *psock, int level, int option, FAR void *value, FAR socklen_t *value_len) { - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( psock->s_domain == PF_LOCAL); #ifdef CONFIG_NET_LOCAL_SCM @@ -1018,7 +1018,7 @@ static int local_socketpair(FAR struct socket *psocks[2]) static int local_shutdown(FAR struct socket *psock, int how) { - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( psock->s_domain == PF_LOCAL); switch (psock->s_type) diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c index b42805ae21e82..c964f7c7b858a 100644 --- a/net/netlink/netlink_sockif.c +++ b/net/netlink/netlink_sockif.c @@ -204,8 +204,6 @@ static void netlink_addref(FAR struct socket *psock) { FAR struct netlink_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); - conn = psock->s_conn; DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255); conn->crefs++; @@ -247,7 +245,7 @@ static int netlink_bind(FAR struct socket *psock, FAR struct sockaddr_nl *nladdr; FAR struct netlink_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && addr != NULL && + DEBUGASSERT(addr != NULL && addrlen >= sizeof(struct sockaddr_nl)); /* Save the address information in the connection structure */ @@ -290,7 +288,7 @@ static int netlink_getsockname(FAR struct socket *psock, FAR struct sockaddr_nl *nladdr; FAR struct netlink_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && addr != NULL && + DEBUGASSERT(addr != NULL && addrlen != NULL && *addrlen >= sizeof(struct sockaddr_nl)); conn = psock->s_conn; @@ -343,7 +341,7 @@ static int netlink_getpeername(FAR struct socket *psock, FAR struct sockaddr_nl *nladdr; FAR struct netlink_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && addr != NULL && + DEBUGASSERT(addr != NULL && addrlen != NULL && *addrlen >= sizeof(struct sockaddr_nl)); conn = psock->s_conn; @@ -386,7 +384,7 @@ static int netlink_connect(FAR struct socket *psock, FAR struct sockaddr_nl *nladdr; FAR struct netlink_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && addr != NULL && + DEBUGASSERT(addr != NULL && addrlen >= sizeof(struct sockaddr_nl)); /* Save the address information in the connection structure */ @@ -473,7 +471,6 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds, FAR struct netlink_conn_s *conn; int ret = OK; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; /* Check if we are setting up or tearing down the poll */ @@ -582,7 +579,7 @@ static ssize_t netlink_sendmsg(FAR struct socket *psock, struct sockaddr_nl nladdr; int ret; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && buf != NULL); + DEBUGASSERT(buf != NULL); /* Validity check, only single iov supported */ @@ -665,7 +662,7 @@ static ssize_t netlink_recvmsg(FAR struct socket *psock, FAR struct netlink_response_s *entry; FAR struct socket_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && buf != NULL); + DEBUGASSERT(buf != NULL); DEBUGASSERT(from == NULL || (fromlen != NULL && *fromlen >= sizeof(struct sockaddr_nl))); diff --git a/net/pkt/pkt_sockif.c b/net/pkt/pkt_sockif.c index 62eeedf3bd824..83832d092b29c 100644 --- a/net/pkt/pkt_sockif.c +++ b/net/pkt/pkt_sockif.c @@ -190,7 +190,7 @@ static void pkt_addref(FAR struct socket *psock) { FAR struct pkt_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && + DEBUGASSERT( (psock->s_type == SOCK_RAW || psock->s_type == SOCK_CTRL)); conn = psock->s_conn; diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index 0ec02c726d6a9..3fd90d4a5f1f2 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -591,8 +591,6 @@ static int sixlowpan_send_packet(FAR struct socket *psock, struct sixlowpan_send_s sinfo; ninfo("len=%lu timeout=%u\n", (unsigned long)len, timeout); - DEBUGASSERT(psock != NULL && dev != NULL && conn != NULL && buf != NULL && - destmac != NULL); memset(&sinfo, 0, sizeof(struct sixlowpan_send_s)); @@ -718,7 +716,6 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf, ninfo("buflen %lu\n", (unsigned long)buflen); sixlowpan_dumpbuffer("Outgoing TCP payload", buf, buflen); - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); DEBUGASSERT(psock->s_type == SOCK_STREAM); /* Make sure that this is a valid socket */ diff --git a/net/sixlowpan/sixlowpan_udpsend.c b/net/sixlowpan/sixlowpan_udpsend.c index da04df94399f7..203e4561df790 100644 --- a/net/sixlowpan/sixlowpan_udpsend.c +++ b/net/sixlowpan/sixlowpan_udpsend.c @@ -157,7 +157,7 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock, ninfo("buflen %lu\n", (unsigned long)buflen); - DEBUGASSERT(psock != NULL && psock->s_conn != NULL && to != NULL); + DEBUGASSERT(to != NULL); DEBUGASSERT(psock->s_type == SOCK_DGRAM); sixlowpan_dumpbuffer("Outgoing UDP payload", buf, buflen); @@ -336,7 +336,6 @@ ssize_t psock_6lowpan_udp_send(FAR struct socket *psock, FAR const void *buf, ninfo("buflen %lu\n", (unsigned long)buflen); - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); DEBUGASSERT(psock->s_type == SOCK_DGRAM); sixlowpan_dumpbuffer("Outgoing UDP payload", buf, buflen); diff --git a/net/tcp/tcp_accept.c b/net/tcp/tcp_accept.c index 07fb4d91679fa..6b0e6b522e0f0 100644 --- a/net/tcp/tcp_accept.c +++ b/net/tcp/tcp_accept.c @@ -217,8 +217,6 @@ int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr, struct accept_s state; int ret; - DEBUGASSERT(psock && newconn); - /* Check the backlog to see if there is a connection already pending for * this listener. */ diff --git a/net/tcp/tcp_close.c b/net/tcp/tcp_close.c index bc1e424bd7424..a706de02e2ec4 100644 --- a/net/tcp/tcp_close.c +++ b/net/tcp/tcp_close.c @@ -220,7 +220,6 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) net_lock(); conn = psock->s_conn; - DEBUGASSERT(conn != NULL); /* Discard our reference to the connection */ diff --git a/net/tcp/tcp_getsockopt.c b/net/tcp/tcp_getsockopt.c index 66e1006e63072..5284716d2b192 100644 --- a/net/tcp/tcp_getsockopt.c +++ b/net/tcp/tcp_getsockopt.c @@ -85,8 +85,7 @@ int tcp_getsockopt(FAR struct socket *psock, int option, FAR struct tcp_conn_s *conn; int ret; - DEBUGASSERT(psock != NULL && value != NULL && value_len != NULL && - psock->s_conn != NULL); + DEBUGASSERT(value != NULL && value_len != NULL); conn = psock->s_conn; /* All of the TCP protocol options apply only TCP sockets. The sockets diff --git a/net/tcp/tcp_monitor.c b/net/tcp/tcp_monitor.c index b5ee8b094fea1..96e73883b2063 100644 --- a/net/tcp/tcp_monitor.c +++ b/net/tcp/tcp_monitor.c @@ -197,8 +197,6 @@ static uint16_t tcp_monitor_event(FAR struct net_driver_s *dev, static void tcp_shutdown_monitor(FAR struct tcp_conn_s *conn, uint16_t flags) { - DEBUGASSERT(conn); - /* Perform callbacks to assure that all sockets, including dup'ed copies, * are informed of the loss of connection event. */ @@ -248,7 +246,6 @@ int tcp_start_monitor(FAR struct socket *psock) FAR struct tcp_conn_s *conn; bool nonblock_conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); conn = psock->s_conn; net_lock(); diff --git a/net/tcp/tcp_setsockopt.c b/net/tcp/tcp_setsockopt.c index a4f1029dbe2bc..fdbb58df93052 100644 --- a/net/tcp/tcp_setsockopt.c +++ b/net/tcp/tcp_setsockopt.c @@ -75,7 +75,6 @@ int tcp_setsockopt(FAR struct socket *psock, int option, FAR struct tcp_conn_s *conn; int ret = OK; - DEBUGASSERT(psock != NULL && value != NULL && psock->s_conn != NULL); conn = psock->s_conn; /* All of the TCP protocol options apply only TCP sockets. The sockets diff --git a/net/tcp/tcp_txdrain.c b/net/tcp/tcp_txdrain.c index 1815e564d4de4..465b94a74c55b 100644 --- a/net/tcp/tcp_txdrain.c +++ b/net/tcp/tcp_txdrain.c @@ -92,7 +92,6 @@ int tcp_txdrain(FAR struct socket *psock, unsigned int timeout) sem_t waitsem; int ret; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); DEBUGASSERT(psock->s_type == SOCK_STREAM); conn = psock->s_conn; diff --git a/net/udp/udp_sendto_buffered.c b/net/udp/udp_sendto_buffered.c index 1eff0e8a24f2c..da01a7bc04b12 100644 --- a/net/udp/udp_sendto_buffered.c +++ b/net/udp/udp_sendto_buffered.c @@ -541,7 +541,6 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, /* Get the underlying the UDP connection structure. */ conn = psock->s_conn; - DEBUGASSERT(conn); /* The length of a datagram to be up to 65,535 octets */ diff --git a/net/udp/udp_sendto_unbuffered.c b/net/udp/udp_sendto_unbuffered.c index 2c70d5ff22435..6e93c22a6dc22 100644 --- a/net/udp/udp_sendto_unbuffered.c +++ b/net/udp/udp_sendto_unbuffered.c @@ -101,7 +101,6 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev, FAR struct sendto_s *pstate) { FAR struct udp_conn_s *conn = pstate->st_conn; - DEBUGASSERT(conn); /* Which domain the socket support */ diff --git a/net/udp/udp_txdrain.c b/net/udp/udp_txdrain.c index 949b1afa4cef3..4bd0da23e24fd 100644 --- a/net/udp/udp_txdrain.c +++ b/net/udp/udp_txdrain.c @@ -92,7 +92,6 @@ int udp_txdrain(FAR struct socket *psock, unsigned int timeout) sem_t waitsem; int ret; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); DEBUGASSERT(psock->s_type == SOCK_DGRAM); conn = psock->s_conn; diff --git a/net/usrsock/usrsock_accept.c b/net/usrsock/usrsock_accept.c index a6dfb04609d79..4912fe149473c 100644 --- a/net/usrsock/usrsock_accept.c +++ b/net/usrsock/usrsock_accept.c @@ -227,8 +227,6 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr, socklen_t outaddrlen = 0; int ret; - DEBUGASSERT(conn); - if (addrlen) { if (*addrlen > 0 && addr == NULL) diff --git a/net/usrsock/usrsock_bind.c b/net/usrsock/usrsock_bind.c index 0d2fa3cf682ba..b3f24661f3112 100644 --- a/net/usrsock/usrsock_bind.c +++ b/net/usrsock/usrsock_bind.c @@ -156,8 +156,6 @@ int usrsock_bind(FAR struct socket *psock, int ret; - DEBUGASSERT(conn); - net_lock(); if (conn->state == USRSOCK_CONN_STATE_UNINITIALIZED || diff --git a/net/usrsock/usrsock_connect.c b/net/usrsock/usrsock_connect.c index 3f4ec8552541a..2fbf0af52be6a 100644 --- a/net/usrsock/usrsock_connect.c +++ b/net/usrsock/usrsock_connect.c @@ -154,8 +154,6 @@ int usrsock_connect(FAR struct socket *psock, int ret; - DEBUGASSERT(conn); - net_lock(); if (conn->state == USRSOCK_CONN_STATE_UNINITIALIZED || diff --git a/net/usrsock/usrsock_listen.c b/net/usrsock/usrsock_listen.c index 7b0318151edf4..8720ca3999d29 100644 --- a/net/usrsock/usrsock_listen.c +++ b/net/usrsock/usrsock_listen.c @@ -148,8 +148,6 @@ int usrsock_listen(FAR struct socket *psock, int backlog) int ret; - DEBUGASSERT(conn); - net_lock(); if (conn->state == USRSOCK_CONN_STATE_UNINITIALIZED || diff --git a/net/usrsock/usrsock_recvmsg.c b/net/usrsock/usrsock_recvmsg.c index f072bc7ef7ed5..0bdc90c8c7a8f 100644 --- a/net/usrsock/usrsock_recvmsg.c +++ b/net/usrsock/usrsock_recvmsg.c @@ -220,8 +220,6 @@ ssize_t usrsock_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, socklen_t outaddrlen = 0; ssize_t ret; - DEBUGASSERT(conn); - if (fromlen) { if (*fromlen > 0 && from == NULL) diff --git a/net/usrsock/usrsock_sendmsg.c b/net/usrsock/usrsock_sendmsg.c index 48fb8545f90ea..f21c9e5acf626 100644 --- a/net/usrsock/usrsock_sendmsg.c +++ b/net/usrsock/usrsock_sendmsg.c @@ -209,8 +209,6 @@ ssize_t usrsock_sendmsg(FAR struct socket *psock, ssize_t ret; - DEBUGASSERT(conn); - net_lock(); if (conn->state == USRSOCK_CONN_STATE_UNINITIALIZED || diff --git a/net/usrsock/usrsock_setsockopt.c b/net/usrsock/usrsock_setsockopt.c index 6b5accdb07327..555db24c4698c 100644 --- a/net/usrsock/usrsock_setsockopt.c +++ b/net/usrsock/usrsock_setsockopt.c @@ -167,8 +167,6 @@ int usrsock_setsockopt(FAR struct socket *psock, int level, int option, int ret; - DEBUGASSERT(conn); - /* SO_[RCV|SND]TIMEO have to be handled locally to break the block i/o */ if (level == SOL_SOCKET && (option == SO_TYPE || diff --git a/net/usrsock/usrsock_sockif.c b/net/usrsock/usrsock_sockif.c index 2a569deb1c7a3..92b3177cfa826 100644 --- a/net/usrsock/usrsock_sockif.c +++ b/net/usrsock/usrsock_sockif.c @@ -158,8 +158,6 @@ static void usrsock_sockif_addref(FAR struct socket *psock) { FAR struct usrsock_conn_s *conn; - DEBUGASSERT(psock != NULL && psock->s_conn != NULL); - conn = psock->s_conn; DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255); conn->crefs++;