mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/staging/media/atomisp: Initialize curr_rules in atomisp_freq_scaling
@ 2026-10-26 16:10 Abdullah Mohammd Sifat
  2026-10-26 16:33 ` Greg KH
  2026-10-26 16:42 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Abdullah Mohammd Sifat @ 2026-10-26 16:10 UTC (permalink / raw)
  To: hansg, mchehab, gregkh
  Cc: linux-media, linux-staging, linux-kernel, Abdullah Mohammd Sifat

The local structure 'curr_rules' is declared on the stack but is
not initialized. Initialize it to zero using empty brackets '{}'
to prevent potential information leakage of stack garbage values.

Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index e66a7d1c7a0e..d4de2bd9a0a5 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -170,7 +170,6 @@ static int write_target_freq_to_hw(struct atomisp_device *isp,
 		dev_err(isp->dev, "DFS target freq is rejected by HW.\n");
 		return -EINVAL;
 	}
-
 	return 0;
 }
 
@@ -180,7 +179,8 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 {
 	const struct atomisp_dfs_config *dfs;
 	unsigned int new_freq;
-	struct atomisp_freq_scaling_rule curr_rules;
+	struct atomisp_freq_scaling_rule curr_rules = {};
+
 	int i, ret;
 	unsigned short fps = 0;
 
-- 
2.53.0


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

* Re: [PATCH] drivers/staging/media/atomisp: Initialize curr_rules in atomisp_freq_scaling
  2026-10-26 16:10 [PATCH] drivers/staging/media/atomisp: Initialize curr_rules in atomisp_freq_scaling Abdullah Mohammd Sifat
@ 2026-10-26 16:33 ` Greg KH
  2026-10-26 16:42 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-10-26 16:33 UTC (permalink / raw)
  To: Abdullah Mohammd Sifat
  Cc: hansg, mchehab, linux-media, linux-staging, linux-kernel

On Mon, Oct 26, 2026 at 04:10:58PM +0000, Abdullah Mohammd Sifat wrote:
> The local structure 'curr_rules' is declared on the stack but is
> not initialized. Initialize it to zero using empty brackets '{}'
> to prevent potential information leakage of stack garbage values.
> 
> Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index e66a7d1c7a0e..d4de2bd9a0a5 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -170,7 +170,6 @@ static int write_target_freq_to_hw(struct atomisp_device *isp,
>  		dev_err(isp->dev, "DFS target freq is rejected by HW.\n");
>  		return -EINVAL;
>  	}
> -
>  	return 0;
>  }
>  

That's not what this change does here :(

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

* Re: [PATCH] drivers/staging/media/atomisp: Initialize curr_rules in atomisp_freq_scaling
  2026-10-26 16:10 [PATCH] drivers/staging/media/atomisp: Initialize curr_rules in atomisp_freq_scaling Abdullah Mohammd Sifat
  2026-10-26 16:33 ` Greg KH
@ 2026-10-26 16:42 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-10-26 16:42 UTC (permalink / raw)
  To: Abdullah Mohammd Sifat
  Cc: hansg, mchehab, gregkh, linux-media, linux-staging, linux-kernel

On Mon, Oct 26, 2026 at 04:10:58PM +0000, Abdullah Mohammd Sifat wrote:
> The local structure 'curr_rules' is declared on the stack but is
> not initialized. Initialize it to zero using empty brackets '{}'
> to prevent potential information leakage of stack garbage values.
> 
> Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>

The commit message says it fixes a bug but there is no fixes tag.

> ---
>  drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index e66a7d1c7a0e..d4de2bd9a0a5 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -170,7 +170,6 @@ static int write_target_freq_to_hw(struct atomisp_device *isp,
>  		dev_err(isp->dev, "DFS target freq is rejected by HW.\n");
>  		return -EINVAL;
>  	}
> -

Deleting this blank line is unrelated and wrong.

>  	return 0;
>  }
>  
> @@ -180,7 +179,8 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
>  {
>  	const struct atomisp_dfs_config *dfs;
>  	unsigned int new_freq;
> -	struct atomisp_freq_scaling_rule curr_rules;
> +	struct atomisp_freq_scaling_rule curr_rules = {};

I reviewed this and the original code is fine.

.isp_freq is never initialized but also never used so that might be
the confusion?

regards,
dan carpenter

> +
>  	int i, ret;
>  	unsigned short fps = 0;
>  
> -- 
> 2.53.0
> 

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

end of thread, other threads:[~2026-10-26 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 16:10 [PATCH] drivers/staging/media/atomisp: Initialize curr_rules in atomisp_freq_scaling Abdullah Mohammd Sifat
2026-10-26 16:33 ` Greg KH
2026-10-26 16:42 ` Dan Carpenter

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

all inboxes | Powered by JetHome®