diff mbox series

[3/3] firewire: Fix using uninitialized value

Message ID 20220512111756.103008-4-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show
Series firewire: fix minor issues | expand

Commit Message

Takashi Sakamoto May 12, 2022, 11:17 a.m. UTC
From: Lv Ruyi <lv.ruyi@zte.com.cn>

If data is null, request->data wouldn't be assigned value. It is random
value, but we use it in handle_exclusive_region_request() and
handle_fcp_region_request() later. Fix the bug by initializing it.

(Revised by Takashi Sakamoto to rebase to the previous patch.)

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 drivers/firewire/core-transaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 49657a793e80..d10d890d7d48 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -778,7 +778,7 @@  static struct fw_request *allocate_request(struct fw_card *card,
 		return NULL;
 	}
 
-	request = kmalloc(struct_size(request, data, length), GFP_ATOMIC);
+	request = kzalloc(struct_size(request, data, length), GFP_ATOMIC);
 	if (request == NULL)
 		return NULL;