[PATCH] socketutils: e is alway not NULL here because cache is static

Dmitry V. Levin ldv at strace.io
Sun Mar 1 12:46:01 UTC 2026


On Sun, Mar 01, 2026 at 02:27:23PM +0800, Weixie Cui wrote:
> From: Weixie Cui <cuiweixie at gmail.com>
> 
> Signed-off-by: Weixie Cui <cuiweixie at gmail.com>
> ---
>  src/socketutils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/socketutils.c b/src/socketutils.c
> index d3a3b9283..9416c7082 100644
> --- a/src/socketutils.c
> +++ b/src/socketutils.c
> @@ -54,7 +54,7 @@ static const char *
>  get_sockaddr_by_inode_cached(const unsigned long inode)
>  {
>  	const cache_entry *const e = &cache[inode & CACHE_MASK];
> -	return (e && inode == e->inode) ? e->details : NULL;
> +	return inode == e->inode ? e->details : NULL;
>  }

The cache is indeed static and therefore is initialized with zeroes.


-- 
ldv


More information about the Strace-devel mailing list