From ed85055edbfbce5830ce987171d678609ef7c18b Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 5 Sep 2022 14:08:13 +0800 Subject: [PATCH] udp: Remove the unnessary check of addr size in udp_readahead Signed-off-by: Xiang Xiao --- net/udp/udp_recvfrom.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/net/udp/udp_recvfrom.c b/net/udp/udp_recvfrom.c index 8fbd2a1d3f..76a2236437 100644 --- a/net/udp/udp_recvfrom.c +++ b/net/udp/udp_recvfrom.c @@ -257,24 +257,14 @@ static inline void udp_readahead(struct udp_recvfrom_s *pstate) } #endif - if (0 -#ifdef CONFIG_NET_IPv6 - || src_addr_size == sizeof(struct sockaddr_in6) -#endif -#ifdef CONFIG_NET_IPv4 - || src_addr_size == sizeof(struct sockaddr_in) -#endif - ) + if (pstate->ir_msg->msg_name) { - if (pstate->ir_msg->msg_name) - { - pstate->ir_msg->msg_namelen = - src_addr_size > pstate->ir_msg->msg_namelen ? - pstate->ir_msg->msg_namelen : src_addr_size; + pstate->ir_msg->msg_namelen = + src_addr_size > pstate->ir_msg->msg_namelen ? + pstate->ir_msg->msg_namelen : src_addr_size; - memcpy(pstate->ir_msg->msg_name, srcaddr, - pstate->ir_msg->msg_namelen); - } + memcpy(pstate->ir_msg->msg_name, srcaddr, + pstate->ir_msg->msg_namelen); } if (pstate->ir_msg->msg_iov->iov_len > 0)