All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure
@ 2024-02-20 15:35 Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 1/4] backlight: da9052: Fully initialize backlight_properties during probe Daniel Thompson
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Daniel Thompson @ 2024-02-20 15:35 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han
  Cc: Daniel Thompson, Luca Weiss, dri-devel, linux-fbdev, linux-kernel

[Sorry for the RESEND so soon... embarrassingly I got Lee's e-mail
address wrong the first time!]

Luca Weiss recently shared a patch to zero the properties structure for
lm3630a... and shortly afterwards I realized I should probably scan for
a similar class of errors in other drivers.

Results follow in the next four patches (they could all be one patch but
for the fact there are different Fixes: tags)!

Daniel Thompson (4):
  backlight: da9052: Fully initialize backlight_properties during probe
  backlight: lm3639: Fully initialize backlight_properties during probe
  backlight: lp8788: Fully initialize backlight_properties during probe
  backlight: mp3309c: Fully initialize backlight_properties during probe

 drivers/video/backlight/da9052_bl.c | 1 +
 drivers/video/backlight/lm3639_bl.c | 1 +
 drivers/video/backlight/lp8788_bl.c | 1 +
 drivers/video/backlight/mp3309c.c   | 1 +
 4 files changed, 4 insertions(+)


base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
--
2.43.0


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

* [PATCH RESEND 1/4] backlight: da9052: Fully initialize backlight_properties during probe
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
@ 2024-02-20 15:35 ` Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 2/4] backlight: lm3639: " Daniel Thompson
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Thompson @ 2024-02-20 15:35 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han
  Cc: Daniel Thompson, Luca Weiss, dri-devel, linux-fbdev, linux-kernel

props is stack allocated and the fields that are not explcitly set
by the probe function need to be zeroed or we'll get undefined behaviour
(especially so power/blank states)!

Fixes: 6ede3d832aaa ("backlight: add driver for DA9052/53 PMIC v1")
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/da9052_bl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index 1cdc8543310b4..b8ff7046510eb 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -117,6 +117,7 @@ static int da9052_backlight_probe(struct platform_device *pdev)
 	wleds->led_reg = platform_get_device_id(pdev)->driver_data;
 	wleds->state = DA9052_WLEDS_OFF;
 
+	memset(&props, 0, sizeof(struct backlight_properties));
 	props.type = BACKLIGHT_RAW;
 	props.max_brightness = DA9052_MAX_BRIGHTNESS;
 
-- 
2.43.0


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

* [PATCH RESEND 2/4] backlight: lm3639: Fully initialize backlight_properties during probe
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 1/4] backlight: da9052: Fully initialize backlight_properties during probe Daniel Thompson
@ 2024-02-20 15:35 ` Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 3/4] backlight: lp8788: " Daniel Thompson
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Thompson @ 2024-02-20 15:35 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han
  Cc: Daniel Thompson, Luca Weiss, dri-devel, linux-fbdev, linux-kernel

props is stack allocated and the fields that are not explcitly set
by the probe function need to be zeroed or we'll get undefined behaviour
(especially so power/blank states)!

Fixes: 0f59858d5119 ("backlight: add new lm3639 backlight driver")
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/lm3639_bl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
index 5246c171497d6..564f62acd7211 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -338,6 +338,7 @@ static int lm3639_probe(struct i2c_client *client)
 	}
 
 	/* backlight */
+	memset(&props, 0, sizeof(struct backlight_properties));
 	props.type = BACKLIGHT_RAW;
 	props.brightness = pdata->init_brt_led;
 	props.max_brightness = pdata->max_brt_led;
-- 
2.43.0


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

* [PATCH RESEND 3/4] backlight: lp8788: Fully initialize backlight_properties during probe
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 1/4] backlight: da9052: Fully initialize backlight_properties during probe Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 2/4] backlight: lm3639: " Daniel Thompson
@ 2024-02-20 15:35 ` Daniel Thompson
  2024-02-20 15:35 ` [PATCH RESEND 4/4] backlight: mp3309c: " Daniel Thompson
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Daniel Thompson @ 2024-02-20 15:35 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han
  Cc: Daniel Thompson, Luca Weiss, dri-devel, linux-fbdev, linux-kernel

props is stack allocated and the fields that are not explcitly set
by the probe function need to be zeroed or we'll get undefined behaviour
(especially so power/blank states)!

Fixes: c5a51053cf3b ("backlight: add new lp8788 backlight driver")
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/lp8788_bl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index d1a14b0db265b..31f97230ee506 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -191,6 +191,7 @@ static int lp8788_backlight_register(struct lp8788_bl *bl)
 	int init_brt;
 	char *name;
 
+	memset(&props, 0, sizeof(struct backlight_properties));
 	props.type = BACKLIGHT_PLATFORM;
 	props.max_brightness = MAX_BRIGHTNESS;
 
-- 
2.43.0


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

* [PATCH RESEND 4/4] backlight: mp3309c: Fully initialize backlight_properties during probe
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
                   ` (2 preceding siblings ...)
  2024-02-20 15:35 ` [PATCH RESEND 3/4] backlight: lp8788: " Daniel Thompson
@ 2024-02-20 15:35 ` Daniel Thompson
  2024-02-23 16:28   ` (subset) " Lee Jones
  2024-02-20 16:48 ` [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Luca Weiss
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Daniel Thompson @ 2024-02-20 15:35 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han
  Cc: Daniel Thompson, Luca Weiss, dri-devel, linux-fbdev, linux-kernel

props is stack allocated and, although this driver initializes all the
fields that are not "owned" by the framework, we'd still like to ensure
it is zeroed to avoid problems from this driver if the fields change.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/mp3309c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c
index 34d71259fac1d..cdf302d6f1cb5 100644
--- a/drivers/video/backlight/mp3309c.c
+++ b/drivers/video/backlight/mp3309c.c
@@ -373,6 +373,7 @@ static int mp3309c_probe(struct i2c_client *client)
 	chip->pdata = pdata;
 
 	/* Backlight properties */
+	memset(&props, 0, sizeof(struct backlight_properties));
 	props.brightness = pdata->default_brightness;
 	props.max_brightness = pdata->max_brightness;
 	props.scale = BACKLIGHT_SCALE_LINEAR;
-- 
2.43.0


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

* Re: [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
                   ` (3 preceding siblings ...)
  2024-02-20 15:35 ` [PATCH RESEND 4/4] backlight: mp3309c: " Daniel Thompson
@ 2024-02-20 16:48 ` Luca Weiss
  2024-02-23 16:31 ` Lee Jones
  2024-02-29 17:39 ` (subset) " Lee Jones
  6 siblings, 0 replies; 9+ messages in thread
From: Luca Weiss @ 2024-02-20 16:48 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han, Daniel Thompson
  Cc: Daniel Thompson, dri-devel, linux-fbdev, linux-kernel

On Dienstag, 20. Februar 2024 16:35:23 CET Daniel Thompson wrote:
> [Sorry for the RESEND so soon... embarrassingly I got Lee's e-mail
> address wrong the first time!]
> 
> Luca Weiss recently shared a patch to zero the properties structure for
> lm3630a... and shortly afterwards I realized I should probably scan for
> a similar class of errors in other drivers.

Thanks for fixing the other drivers! Was definitely a fun one to debug :)

> 
> Results follow in the next four patches (they could all be one patch but
> for the fact there are different Fixes: tags)!
> 
> Daniel Thompson (4):
>   backlight: da9052: Fully initialize backlight_properties during probe
>   backlight: lm3639: Fully initialize backlight_properties during probe
>   backlight: lp8788: Fully initialize backlight_properties during probe
>   backlight: mp3309c: Fully initialize backlight_properties during probe
> 
>  drivers/video/backlight/da9052_bl.c | 1 +
>  drivers/video/backlight/lm3639_bl.c | 1 +
>  drivers/video/backlight/lp8788_bl.c | 1 +
>  drivers/video/backlight/mp3309c.c   | 1 +
>  4 files changed, 4 insertions(+)
> 
> 
> base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
> --
> 2.43.0
> 
> 





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

* Re: (subset) [PATCH RESEND 4/4] backlight: mp3309c: Fully initialize backlight_properties during probe
  2024-02-20 15:35 ` [PATCH RESEND 4/4] backlight: mp3309c: " Daniel Thompson
@ 2024-02-23 16:28   ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2024-02-23 16:28 UTC (permalink / raw)
  To: Lee Jones, Jingoo Han, Daniel Thompson
  Cc: Luca Weiss, dri-devel, linux-fbdev, linux-kernel

On Tue, 20 Feb 2024 15:35:27 +0000, Daniel Thompson wrote:
> props is stack allocated and, although this driver initializes all the
> fields that are not "owned" by the framework, we'd still like to ensure
> it is zeroed to avoid problems from this driver if the fields change.
> 
> 

Applied, thanks!

[4/4] backlight: mp3309c: Fully initialize backlight_properties during probe
      commit: 50a2c0aee92699ed47076636b652f9d27a20fbef

--
Lee Jones [李琼斯]


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

* Re: [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
                   ` (4 preceding siblings ...)
  2024-02-20 16:48 ` [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Luca Weiss
@ 2024-02-23 16:31 ` Lee Jones
  2024-02-29 17:39 ` (subset) " Lee Jones
  6 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2024-02-23 16:31 UTC (permalink / raw)
  To: Daniel Thompson
  Cc: Jingoo Han, Luca Weiss, dri-devel, linux-fbdev, linux-kernel

On Tue, 20 Feb 2024, Daniel Thompson wrote:

> [Sorry for the RESEND so soon... embarrassingly I got Lee's e-mail
> address wrong the first time!]
> 
> Luca Weiss recently shared a patch to zero the properties structure for
> lm3630a... and shortly afterwards I realized I should probably scan for
                                      ^

> a similar class of errors in other drivers.
> 
> Results follow in the next four patches (they could all be one patch but
> for the fact there are different Fixes: tags)!
> 
> Daniel Thompson (4):
>   backlight: da9052: Fully initialize backlight_properties during probe
                             ^
>   backlight: lm3639: Fully initialize backlight_properties during probe
                             ^
>   backlight: lp8788: Fully initialize backlight_properties during probe
                             ^
>   backlight: mp3309c: Fully initialize backlight_properties during probe
                              ^

I think you may have the wrong locale set mate! :)

>  drivers/video/backlight/da9052_bl.c | 1 +
>  drivers/video/backlight/lm3639_bl.c | 1 +
>  drivers/video/backlight/lp8788_bl.c | 1 +
>  drivers/video/backlight/mp3309c.c   | 1 +
>  4 files changed, 4 insertions(+)
> 
> 
> base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
> --
> 2.43.0
> 

-- 
Lee Jones [李琼斯]

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

* Re: (subset) [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure
  2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
                   ` (5 preceding siblings ...)
  2024-02-23 16:31 ` Lee Jones
@ 2024-02-29 17:39 ` Lee Jones
  6 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2024-02-29 17:39 UTC (permalink / raw)
  To: Jingoo Han, Daniel Thompson
  Cc: Luca Weiss, dri-devel, linux-fbdev, linux-kernel

On Tue, 20 Feb 2024 15:35:23 +0000, Daniel Thompson wrote:
> [Sorry for the RESEND so soon... embarrassingly I got Lee's e-mail
> address wrong the first time!]
> 
> Luca Weiss recently shared a patch to zero the properties structure for
> lm3630a... and shortly afterwards I realized I should probably scan for
> a similar class of errors in other drivers.
> 
> [...]

Applied, thanks!

[1/4] backlight: da9052: Fully initialize backlight_properties during probe
      commit: fc159b40e7980e7f78dbaa72dcc4e8f523dbfd92
[2/4] backlight: lm3639: Fully initialize backlight_properties during probe
      commit: aeb7ab878e90041776eae839faa117570dbcce93
[3/4] backlight: lp8788: Fully initialize backlight_properties during probe
      commit: cd1995b6ac7384149ad755b74e3c3eb25195ab81

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2024-02-29 17:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 15:35 [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Daniel Thompson
2024-02-20 15:35 ` [PATCH RESEND 1/4] backlight: da9052: Fully initialize backlight_properties during probe Daniel Thompson
2024-02-20 15:35 ` [PATCH RESEND 2/4] backlight: lm3639: " Daniel Thompson
2024-02-20 15:35 ` [PATCH RESEND 3/4] backlight: lp8788: " Daniel Thompson
2024-02-20 15:35 ` [PATCH RESEND 4/4] backlight: mp3309c: " Daniel Thompson
2024-02-23 16:28   ` (subset) " Lee Jones
2024-02-20 16:48 ` [PATCH RESEND 0/4] Ensure all backlight drivers zero the properties structure Luca Weiss
2024-02-23 16:31 ` Lee Jones
2024-02-29 17:39 ` (subset) " Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.