linux-i3c.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] i3c/master: Fix uninitialized variable next_addr
@ 2020-11-24 12:35 Colin King
  2020-11-24 15:48 ` Nicolas Pitre
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-11-24 12:35 UTC (permalink / raw)
  To: Boris Brezillon, Nicolas Pitre, linux-i3c; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
---
 drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
index 6dd234a82892..d97c3175e0e2 100644
--- a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
+++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
@@ -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);
-- 
2.29.2


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* Re: [PATCH][next] i3c/master: Fix uninitialized variable next_addr
  2020-11-24 12:35 [PATCH][next] i3c/master: Fix uninitialized variable next_addr Colin King
@ 2020-11-24 15:48 ` Nicolas Pitre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pitre @ 2020-11-24 15:48 UTC (permalink / raw)
  To: Colin King; +Cc: linux-i3c, kernel-janitors, linux-kernel, Boris Brezillon

On Tue, 24 Nov 2020, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> 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 <colin.king@canonical.com>

Acked-by: Nicolas Pitre <npitre@baylibre.com>





> ---
>  drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
> index 6dd234a82892..d97c3175e0e2 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
> @@ -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);
> -- 
> 2.29.2
> 
> 

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

end of thread, other threads:[~2020-11-25  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 12:35 [PATCH][next] i3c/master: Fix uninitialized variable next_addr Colin King
2020-11-24 15:48 ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).