lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f7e2974c-5513-4a05-b136-9902ffc31dbc@gmail.com>
Date: Sun, 26 Oct 2025 23:09:38 +0500
From: Muhammad Usama Anjum <MUsamaAnjum@...il.com>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>,
 Pablo Neira Ayuso <pablo@...filter.org>,
 Jozsef Kadlecsik <kadlec@...filter.org>, Florian Westphal <fw@...len.de>,
 Phil Sutter <phil@....cc>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
 Shuah Khan <shuah@...nel.org>
Cc: netfilter-devel@...r.kernel.org, coreteam@...filter.org,
 netdev@...r.kernel.org, linux-kselftest@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftest: net: fix socklen_t type mismatch in
 sctp_collision test

On 10/26/25 10:46 PM, Ankit Khushwaha wrote:
> Socket APIs like recvfrom(), accept(), and getsockname() expect socklen_t*
> arg, but tests were using int variables. This causes -Wpointer-sign 
> warnings on platforms where socklen_t is unsigned.
> 
> Change the variable type from int to socklen_t to resolve the warning and
> ensure type safety across platforms.
Yes, socklen_t must have 32 bits which would be possible by using unsigned
int or better socklen_t type.

> 
> warning fixed:
> 
> sctp_collision.c:62:70: warning: passing 'int *' to parameter of 
> type 'socklen_t *' (aka 'unsigned int *') converts between pointers to 
> integer types with different sign [-Wpointer-sign]
>    62 |                 ret = recvfrom(sd, buf, sizeof(buf), 
> 									0, (struct sockaddr *)&daddr, &len);
>       |                                                           ^~~~
> /usr/include/sys/socket.h:165:27: note: passing argument to 
> parameter '__addr_len' here
>   165 |                          socklen_t *__restrict __addr_len);
>       |                                                ^
> 
> Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@...labora.com>

> ---
>  tools/testing/selftests/net/netfilter/sctp_collision.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/netfilter/sctp_collision.c b/tools/testing/selftests/net/netfilter/sctp_collision.c
> index 21bb1cfd8a85..91df996367e9 100644
> --- a/tools/testing/selftests/net/netfilter/sctp_collision.c
> +++ b/tools/testing/selftests/net/netfilter/sctp_collision.c
> @@ -9,7 +9,8 @@
>  int main(int argc, char *argv[])
>  {
>  	struct sockaddr_in saddr = {}, daddr = {};
> -	int sd, ret, len = sizeof(daddr);
> +	int sd, ret;
> +	socklen_t len = sizeof(daddr);
>  	struct timeval tv = {25, 0};
>  	char buf[] = "hello";
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ