All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firewire: ohci: Initialize payload_bus to avoid uninitialized use warning
@ 2025-07-10  7:39 Purva Yeshi
  2025-07-10 12:52 ` Takashi Sakamoto
  0 siblings, 1 reply; 3+ messages in thread
From: Purva Yeshi @ 2025-07-10  7:39 UTC (permalink / raw)
  To: o-takashi; +Cc: linux1394-devel, linux-kernel, Purva Yeshi

Fix Smatch-detected error:
drivers/firewire/ohci.c:1514 at_context_queue_packet()
error: uninitialized symbol 'payload_bus'.

Smatch reports a potential uninitialized use of 'payload_bus' in
at_context_queue_packet(). If packet->payload_length is zero, the
variable may not be set before reaching the dma_unmap_single() call,
which could lead to undefined behavior.

Initialize 'payload_bus' to 0 to ensure it has a defined value in all
code paths, preventing any uninitialized access.

Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
---
 drivers/firewire/ohci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index edaedd156a6d..c05d90511f2b 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -1392,7 +1392,7 @@ static int at_context_queue_packet(struct context *ctx,
 				   struct fw_packet *packet)
 {
 	struct fw_ohci *ohci = ctx->ohci;
-	dma_addr_t d_bus, payload_bus;
+	dma_addr_t d_bus, payload_bus = 0;
 	struct driver_data *driver_data;
 	struct descriptor *d, *last;
 	__le32 *header;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-10 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10  7:39 [PATCH] firewire: ohci: Initialize payload_bus to avoid uninitialized use warning Purva Yeshi
2025-07-10 12:52 ` Takashi Sakamoto
2025-07-10 15:10   ` Purva Yeshi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.