Skip to contentSkip to conversation

drm/mgag200: Fix uninitialized variable delta

PATCH In review Colin King 2 participants 3 messages Aug 17, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 drm/mgag200: Fix uninitialized variable delta

From: Colin Ian King <[email protected]>

The variable delta is not initialized and this will cause unexpected behaviour with the comparison of tmpdelta < delta. Fix this by setting it to 0xffffffff. This matches the behaviour as in the similar function mgag200_pixpll_compute_g200se_04.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 2545ac960364 ("drm/mgag200: Abstract pixel PLL via struct mgag200_pll")
---
 drivers/gpu/drm/mgag200/mgag200_pll.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/mgag200/mgag200_pll.c +1 -0
index 7c903cf19c0d..18f1a6dd019a 100644
@@ -125,6 +125,7 @@ static int mgag200_pixpll_compute_g200se_00(struct mgag200_pll *pixpll, long clo
 
 	m = n = p = s = 0;
 	permitteddelta = clock * 5 / 1000;
+	delta = 0xffffffff;
 
 	for (testp = 8; testp > 0; testp /= 2) {
 		if (clock * testp > vcomax)
Signature · 1 line
2.32.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi

Am 17.08.21 um 18:32 schrieb Colin King:

Quoted 10 lines

From: Colin Ian King <[email protected]>

The variable delta is not initialized and this will cause unexpected behaviour with the comparison of tmpdelta < delta. Fix this by setting it to 0xffffffff. This matches the behaviour as in the similar function mgag200_pixpll_compute_g200se_04.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 2545ac960364 ("drm/mgag200: Abstract pixel PLL via struct mgag200_pll")

But the commit message needs Fixes etc. I just sent out a patch for this issue myself. I'd like to merge both patches' tags and commit the result under your name. (You were first.) Is that ok for you?

Best regards
Thomas

Quoted 17 lines
---
  drivers/gpu/drm/mgag200/mgag200_pll.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/mgag200/mgag200_pll.c +1 -0
index 7c903cf19c0d..18f1a6dd019a 100644
@@ -125,6 +125,7 @@ static int mgag200_pixpll_compute_g200se_00(struct mgag200_pll *pixpll, long clo
 
  	m = n = p = s = 0;
  	permitteddelta = clock * 5 / 1000;
+	delta = 0xffffffff;
 
  	for (testp = 8; testp > 0; testp /= 2) {
  		if (clock * testp > vcomax)
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
#2 lore raw
Quoted 15 lines · Thomas Zimmermann

Hi

Am 17.08.21 um 18:32 schrieb Colin King:

Quoted 11 lines

From: Colin Ian King <[email protected]>

The variable delta is not initialized and this will cause unexpected behaviour with the comparison of tmpdelta < delta. Fix this by setting it to 0xffffffff. This matches the behaviour as in the similar function mgag200_pixpll_compute_g200se_04.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 2545ac960364 ("drm/mgag200: Abstract pixel PLL via struct

mgag200_pll")

Quoted 5 lines

But the commit message needs Fixes etc. I just sent out a patch for this issue myself. I'd like to merge both patches' tags and commit the result under your name. (You were first.) Is that ok for you?

Sure. Go ahead, Thanks

Colin

Quoted 22 lines

Best regards
Thomas

Quoted 17 lines

---
  drivers/gpu/drm/mgag200/mgag200_pll.c | 1 +

  1 file changed, 1 insertion(+)
drivers/gpu/drm/mgag200/mgag200_pll.c +0 -0
index 7c903cf19c0d..18f1a6dd019a 100644
@@ -125,6 +125,7 @@ static int mgag200_pixpll_compute_g200se_00(struct

mgag200_pll *pixpll, long clo
        m = n = p = s = 0;
      permitteddelta = clock * 5 / 1000;
+    delta = 0xffffffff;
        for (testp = 8; testp > 0; testp /= 2) {
          if (clock * testp > vcomax)