Skip to contentSkip to conversation

ALSA: firewire-lib: fix uninitialized local variable

PATCH In review Alexey Nepomnyashih 2 participants 2 messages Mar 16 – Mar 17

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: firewire-lib: fix uninitialized local variable

Similar to commit d8dc8720468a ("ALSA: firewire-lib: fix uninitialized local variable"), the local variable curr_cycle_time in process_rx_packets() is declared without initialization.

When the tracepoint event is not probed, the variable may appear to be used without being initialized. In practice the value is only relevant when the tracepoint is enabled, however initializing it avoids potential use of an uninitialized value and improves code safety.

Initialize curr_cycle_time to zero.

Fixes fef4e61b0b76 ("ALSA: firewire-lib: extend tracepoints event including CYCLE_TIME of 1394 OHCI")

---

 sound/firewire/amdtp-stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/amdtp-stream.c +1 -1
index e97721f80f65..8e70da850fac 100644
@@ -1164,7 +1164,7 @@ static void process_rx_packets(struct fw_iso_context *context, u32 tstamp, size_
 	struct pkt_desc *desc = s->packet_descs_cursor;
 	unsigned int pkt_header_length;
 	unsigned int packets;
-	u32 curr_cycle_time;
+	u32 curr_cycle_time = 0;
 	bool need_hw_irq;
 	int i;
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Alexey Nepomnyashih

Similar to commit d8dc8720468a ("ALSA: firewire-lib: fix uninitialized local variable"), the local variable curr_cycle_time in process_rx_packets() is declared without initialization.

When the tracepoint event is not probed, the variable may appear to be used without being initialized. In practice the value is only relevant when the tracepoint is enabled, however initializing it avoids potential use of an uninitialized value and improves code safety.

Quoted 5 lines

Initialize curr_cycle_time to zero.

Fixes fef4e61b0b76 ("ALSA: firewire-lib: extend tracepoints event including CYCLE_TIME of 1394 OHCI")

Applied now. Thanks.

Takashi