linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: Potential uninitialized field in "pll"
@ 2019-10-10  4:38 Yizhuo
  2019-10-10  9:04 ` Greg Kroah-Hartman
  2019-10-10  9:53 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Yizhuo @ 2019-10-10  4:38 UTC (permalink / raw)
  Cc: Yizhuo, Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman,
	linux-fbdev, devel, linux-kernel

Inside function set_chip_clock(), struct pll is supposed to be
initialized in sm750_calc_pll_value(), if condition
"diff < mini_diff" in sm750_calc_pll_value() cannot be fulfilled,
then some field of pll will not be initialized but used in
function sm750_format_pll_reg(), which is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@ucr.edu>
---
 drivers/staging/sm750fb/ddk750_chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 5a317cc98a4b..31b3cf9c2d8b 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -55,7 +55,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void set_chip_clock(unsigned int frequency)
 {
-	struct pll_value pll;
+	struct pll_value pll = {};
 	unsigned int actual_mx_clk;
 
 	/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */
-- 
2.17.1


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

* Re: [PATCH] staging: sm750fb: Potential uninitialized field in "pll"
  2019-10-10  4:38 [PATCH] staging: sm750fb: Potential uninitialized field in "pll" Yizhuo
@ 2019-10-10  9:04 ` Greg Kroah-Hartman
  2019-10-10  9:53 ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-10-10  9:04 UTC (permalink / raw)
  To: Yizhuo; +Cc: devel, linux-fbdev, Teddy Wang, linux-kernel, Sudip Mukherjee

On Wed, Oct 09, 2019 at 09:38:08PM -0700, Yizhuo wrote:
> Inside function set_chip_clock(), struct pll is supposed to be
> initialized in sm750_calc_pll_value(), if condition
> "diff < mini_diff" in sm750_calc_pll_value() cannot be fulfilled,
> then some field of pll will not be initialized but used in
> function sm750_format_pll_reg(), which is potentially unsafe.
> 
> Signed-off-by: Yizhuo <yzhai003@ucr.edu>
> ---
>  drivers/staging/sm750fb/ddk750_chip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> index 5a317cc98a4b..31b3cf9c2d8b 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -55,7 +55,7 @@ static unsigned int get_mxclk_freq(void)
>   */
>  static void set_chip_clock(unsigned int frequency)
>  {
> -	struct pll_value pll;
> +	struct pll_value pll = {};
>  	unsigned int actual_mx_clk;
>  
>  	/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */

This doesn't apply to my tree at all.  Please rebase it against the
staging-next branch of staging.git and resend.

thanks,

greg k-h

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

* Re: [PATCH] staging: sm750fb: Potential uninitialized field in "pll"
  2019-10-10  4:38 [PATCH] staging: sm750fb: Potential uninitialized field in "pll" Yizhuo
  2019-10-10  9:04 ` Greg Kroah-Hartman
@ 2019-10-10  9:53 ` Dan Carpenter
  2019-10-11  0:37   ` Yizhuo Zhai
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2019-10-10  9:53 UTC (permalink / raw)
  To: Yizhuo
  Cc: devel, linux-fbdev, Teddy Wang, Greg Kroah-Hartman, linux-kernel,
	Sudip Mukherjee

On Wed, Oct 09, 2019 at 09:38:08PM -0700, Yizhuo wrote:
> Inside function set_chip_clock(), struct pll is supposed to be
> initialized in sm750_calc_pll_value(), if condition
> "diff < mini_diff" in sm750_calc_pll_value() cannot be fulfilled,
> then some field of pll will not be initialized but used in
> function sm750_format_pll_reg(), which is potentially unsafe.
> 
> Signed-off-by: Yizhuo <yzhai003@ucr.edu>

The patch is correct, but it doesn't apply to linux-next any more.  Can
you re-write it on top of the most recent staging-next and resend?

regards,
dan carpenter


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

* Re: [PATCH] staging: sm750fb: Potential uninitialized field in "pll"
  2019-10-10  9:53 ` Dan Carpenter
@ 2019-10-11  0:37   ` Yizhuo Zhai
  0 siblings, 0 replies; 4+ messages in thread
From: Yizhuo Zhai @ 2019-10-11  0:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, linux-fbdev, Teddy Wang, Greg Kroah-Hartman, linux-kernel,
	Sudip Mukherjee

Sorry about that, let me resend it .

On Thu, Oct 10, 2019 at 2:53 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Wed, Oct 09, 2019 at 09:38:08PM -0700, Yizhuo wrote:
> > Inside function set_chip_clock(), struct pll is supposed to be
> > initialized in sm750_calc_pll_value(), if condition
> > "diff < mini_diff" in sm750_calc_pll_value() cannot be fulfilled,
> > then some field of pll will not be initialized but used in
> > function sm750_format_pll_reg(), which is potentially unsafe.
> >
> > Signed-off-by: Yizhuo <yzhai003@ucr.edu>
>
> The patch is correct, but it doesn't apply to linux-next any more.  Can
> you re-write it on top of the most recent staging-next and resend?
>
> regards,
> dan carpenter
>


-- 
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

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

end of thread, other threads:[~2019-10-11  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10  4:38 [PATCH] staging: sm750fb: Potential uninitialized field in "pll" Yizhuo
2019-10-10  9:04 ` Greg Kroah-Hartman
2019-10-10  9:53 ` Dan Carpenter
2019-10-11  0:37   ` Yizhuo Zhai

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).