public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
@ 2024-09-26 15:13 Qianqiang Liu
  2024-09-27 10:32 ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Qianqiang Liu @ 2024-09-26 15:13 UTC (permalink / raw)
  To: andi.shyti; +Cc: shyam-sundar.s-k, linux-i2c, linux-kernel, Qianqiang Liu

The len variable is not initialized, which may cause the for loop to
behave unexpectedly.

Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
 drivers/i2c/busses/i2c-amd-asf-plat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c
index 47e0c90341aed..ba47df5370c72 100644
--- a/drivers/i2c/busses/i2c-amd-asf-plat.c
+++ b/drivers/i2c/busses/i2c-amd-asf-plat.c
@@ -61,7 +61,7 @@ static void amd_asf_process_target(struct work_struct *work)
 	unsigned short piix4_smba = dev->port_addr->start;
 	u8 data[ASF_BLOCK_MAX_BYTES];
 	u8 bank, reg, cmd;
-	u8 len, idx, val;
+	u8 len = 0, idx, val;
 
 	/* Read target status register */
 	reg = inb_p(ASFSLVSTA);
-- 
2.39.5


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

* Re: [PATCH] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
  2024-09-26 15:13 [PATCH] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target Qianqiang Liu
@ 2024-09-27 10:32 ` Dan Carpenter
  2024-09-27 13:34   ` [PATCH v2] " Qianqiang Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2024-09-27 10:32 UTC (permalink / raw)
  To: Qianqiang Liu; +Cc: andi.shyti, shyam-sundar.s-k, linux-i2c, linux-kernel

On Thu, Sep 26, 2024 at 11:13:48PM +0800, Qianqiang Liu wrote:
> The len variable is not initialized, which may cause the for loop to
> behave unexpectedly.
> 
> Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>

You forgot the Fixes tag.

Fixes: 20c3cc299218 ("i2c: amd-asf: Add routine to handle the ASF slave process")

regards,
dan carpenter



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

* [PATCH v2] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
  2024-09-27 10:32 ` Dan Carpenter
@ 2024-09-27 13:34   ` Qianqiang Liu
  2024-09-27 13:37     ` Dan Carpenter
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Qianqiang Liu @ 2024-09-27 13:34 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: andi.shyti, shyam-sundar.s-k, linux-i2c, linux-kernel

The len variable is not initialized, which may cause the for loop to
behave unexpectedly.

Fixes: 20c3cc299218 ("i2c: amd-asf: Add routine to handle the ASF slave process")
Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
 drivers/i2c/busses/i2c-amd-asf-plat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c
index 47e0c90341aed..ba47df5370c72 100644
--- a/drivers/i2c/busses/i2c-amd-asf-plat.c
+++ b/drivers/i2c/busses/i2c-amd-asf-plat.c
@@ -61,7 +61,7 @@ static void amd_asf_process_target(struct work_struct *work)
 	unsigned short piix4_smba = dev->port_addr->start;
 	u8 data[ASF_BLOCK_MAX_BYTES];
 	u8 bank, reg, cmd;
-	u8 len, idx, val;
+	u8 len = 0, idx, val;
 
 	/* Read target status register */
 	reg = inb_p(ASFSLVSTA);
-- 
2.39.5


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

* Re: [PATCH v2] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
  2024-09-27 13:34   ` [PATCH v2] " Qianqiang Liu
@ 2024-09-27 13:37     ` Dan Carpenter
  2024-09-30  4:33     ` Shyam Sundar S K
  2024-10-01 13:25     ` Andi Shyti
  2 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2024-09-27 13:37 UTC (permalink / raw)
  To: Qianqiang Liu; +Cc: andi.shyti, shyam-sundar.s-k, linux-i2c, linux-kernel

On Fri, Sep 27, 2024 at 09:34:44PM +0800, Qianqiang Liu wrote:
> The len variable is not initialized, which may cause the for loop to
> behave unexpectedly.
> 
> Fixes: 20c3cc299218 ("i2c: amd-asf: Add routine to handle the ASF slave process")
> Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
> ---

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


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

* Re: [PATCH v2] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
  2024-09-27 13:34   ` [PATCH v2] " Qianqiang Liu
  2024-09-27 13:37     ` Dan Carpenter
@ 2024-09-30  4:33     ` Shyam Sundar S K
  2024-10-01  5:57       ` Qianqiang Liu
  2024-10-01 13:25     ` Andi Shyti
  2 siblings, 1 reply; 7+ messages in thread
From: Shyam Sundar S K @ 2024-09-30  4:33 UTC (permalink / raw)
  To: Qianqiang Liu, Dan Carpenter; +Cc: andi.shyti, linux-i2c, linux-kernel

Hi,

On 9/27/2024 19:04, Qianqiang Liu wrote:
> The len variable is not initialized, which may cause the for loop to
> behave unexpectedly.
> 
> Fixes: 20c3cc299218 ("i2c: amd-asf: Add routine to handle the ASF slave process")
> Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>

Thank you for the fix.

Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Thanks,
Shyam

> ---
>  drivers/i2c/busses/i2c-amd-asf-plat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c
> index 47e0c90341aed..ba47df5370c72 100644
> --- a/drivers/i2c/busses/i2c-amd-asf-plat.c
> +++ b/drivers/i2c/busses/i2c-amd-asf-plat.c
> @@ -61,7 +61,7 @@ static void amd_asf_process_target(struct work_struct *work)
>  	unsigned short piix4_smba = dev->port_addr->start;
>  	u8 data[ASF_BLOCK_MAX_BYTES];
>  	u8 bank, reg, cmd;
> -	u8 len, idx, val;
> +	u8 len = 0, idx, val;
>  
>  	/* Read target status register */
>  	reg = inb_p(ASFSLVSTA);

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

* Re: [PATCH v2] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
  2024-09-30  4:33     ` Shyam Sundar S K
@ 2024-10-01  5:57       ` Qianqiang Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Qianqiang Liu @ 2024-10-01  5:57 UTC (permalink / raw)
  To: andi.shyti; +Cc: Shyam-sundar.S-k, Dan Carpenter, linux-i2c, linux-kernel

Hi Andi,

Could you please review this patch?

-- 
Best,
Qianqiang Liu


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

* Re: [PATCH v2] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target
  2024-09-27 13:34   ` [PATCH v2] " Qianqiang Liu
  2024-09-27 13:37     ` Dan Carpenter
  2024-09-30  4:33     ` Shyam Sundar S K
@ 2024-10-01 13:25     ` Andi Shyti
  2 siblings, 0 replies; 7+ messages in thread
From: Andi Shyti @ 2024-10-01 13:25 UTC (permalink / raw)
  To: Qianqiang Liu; +Cc: Dan Carpenter, shyam-sundar.s-k, linux-i2c, linux-kernel

Hi Qianqiang,

On Fri, Sep 27, 2024 at 09:34:44PM GMT, Qianqiang Liu wrote:
> The len variable is not initialized, which may cause the for loop to
> behave unexpectedly.
> 
> Fixes: 20c3cc299218 ("i2c: amd-asf: Add routine to handle the ASF slave process")
> Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>

This patch is fixing a commit still in i2c/i2c-host.

Applied to i2c/i2c-host.

Thanks,
Andi

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

end of thread, other threads:[~2024-10-01 13:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 15:13 [PATCH] i2c: amd-asf: Fix uninitialized variables issue in amd_asf_process_target Qianqiang Liu
2024-09-27 10:32 ` Dan Carpenter
2024-09-27 13:34   ` [PATCH v2] " Qianqiang Liu
2024-09-27 13:37     ` Dan Carpenter
2024-09-30  4:33     ` Shyam Sundar S K
2024-10-01  5:57       ` Qianqiang Liu
2024-10-01 13:25     ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox