git: 8d3f96bd85c9 - releng/14.1 - sound: Correctly check nvlist_unpack() error

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 22 May 2024 13:23:20 UTC
The branch releng/14.1 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d3f96bd85c9519cef76d0727b00082354a2134b

commit 8d3f96bd85c9519cef76d0727b00082354a2134b
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-05-20 14:18:33 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-05-22 13:22:40 +0000

    sound: Correctly check nvlist_unpack() error
    
    The current check is never false and if nvlist_unpack() fails, we might
    panic later down the road.
    
    PR:             266144
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 day
    Reviewed by:    dev_submerge.ch, emaste
    Differential Revision:  https://reviews.freebsd.org/D45237
    
    (cherry picked from commit 64f4e2db6d19d8ab520903a197fcaa8cc7ab9f9a)
    (cherry picked from commit 45feaa73c68011bbba647d1eb6f86a166a0453e9)
    
    Approved by:    re (cperciva)
---
 sys/dev/sound/pcm/sndstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c
index eb5c68c7c519..2d66d8760327 100644
--- a/sys/dev/sound/pcm/sndstat.c
+++ b/sys/dev/sound/pcm/sndstat.c
@@ -706,7 +706,7 @@ sndstat_unpack_user_nvlbuf(const void *unvlbuf, size_t nbytes, nvlist_t **nvl)
 	}
 	*nvl = nvlist_unpack(nvlbuf, nbytes, 0);
 	free(nvlbuf, M_DEVBUF);
-	if (nvl == NULL) {
+	if (*nvl == NULL) {
 		return (EINVAL);
 	}