[PATCH][next] ALSA: firewire-lib: Fix uninitialized variable err issue

From: Colin King
Date: Thu May 20 2021 - 04:34:34 EST


From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

Currently in the case where the payload_length is less than the
cip_header_size the error return variable err is not being set
and function parse_ir_ctx_header can return an uninitialized
error return value. Fix this by setting err to zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: c09010eeb373 ("ALSA: firewire-lib: handle the case that empty isochronous packet payload for CIP")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
sound/firewire/amdtp-stream.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index af5c3629f1ac..242b1147d768 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -663,6 +663,7 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
} else {
// Handle the cycle so that empty packet arrives.
cip_header = NULL;
+ err = 0;
*data_blocks = 0;
*syt = 0;
}
--
2.31.1