Re: [PATCH] handshake: don't print NULL pmksa pointer

Denis Kenzior <[email protected]>
Newsgroups dev.linux.lists.iwd
Message-ID <[email protected]>
Hi James,

On 1/6/25 7:46 AM, James Prestwood wrote:
> This is undefined behavior so if no pmksa is found don't print.
> ---
>   src/handshake.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/handshake.c b/src/handshake.c
> index f73f91d1..bee76b26 100644
> --- a/src/handshake.c
> +++ b/src/handshake.c
> @@ -1272,11 +1272,11 @@ void handshake_state_cache_pmksa(struct handshake_state *s)
>   {
>   	struct pmksa *pmksa = handshake_state_steal_pmksa(s);
>   
> -	l_debug("%p", pmksa);
> -

Why is this behavior undefined? Would it not just print 0x0000...?

>   	if (!pmksa)
>   		return;
>   
> +	l_debug("%p", pmksa);
> +
>   	if (L_WARN_ON(pmksa_cache_put(pmksa) < 0))
>   		l_free(pmksa);
>   }

Regards,
-Denis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.