i3c/master: Fix uninitialized variable next_addr
Subsystems (2)
PATCH 1/1 i3c/master: Fix uninitialized variable next_addr
From: Colin Ian King <[email protected]>
The variable next_addr is not initialized and is being used in a call to i3c_master_get_free_addr as a starting point to find the next address. Fix this by initializing next_addr to 0 to avoid an uninitialized garbage starting address from being used.
Addresses-Coverity: ("Uninitialized scalar variable")
Fixes 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver")
Signed-off-by Colin Ian King <[email protected]>
--- drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/mipi-i3c-hci/cmd_v1.c +1 -1
@@ -293,7 +293,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci) {struct hci_xfer *xfer;int ret, dat_idx =-1 ; -u8 next_addr; +u8 next_addr =0 ;u64 pid;unsigned int dcr, bcr;DECLARE_COMPLETION_ONSTACK (done);
Signature · 1 line
2.29.2
Quoted 10 lines · Colin King
From: Colin Ian King <[email protected]>
The variable
next_addris not initialized and is being used in a call toi3c_master_get_free_addras a starting point to find the next address. Fix this by initializingnext_addrto 0 to avoid an uninitialized garbage starting address from being used.Addresses-Coverity: ("Uninitialized scalar variable")
Fixes 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver")Signed-off-by Colin Ian King <[email protected]>
Acked-by Nicolas Pitre <[email protected]>
Quoted 21 lines
--- drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i3c/master/mipi-i3c-hci/cmd_v1.c +1
-1@@ -293,7 +293,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci) {struct hci_xfer *xfer;int ret, dat_idx =-1 ; -u8 next_addr; +u8 next_addr =0 ;u64 pid;unsigned int dcr, bcr;DECLARE_COMPLETION_ONSTACK (done);Signature · 1 line
2.29.2