All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode()
@ 2024-03-16  9:45 Dan Carpenter
  2024-03-18 10:20 ` Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dan Carpenter @ 2024-03-16  9:45 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Flavio Suligoi, Lee Jones, Daniel Thompson, Jingoo Han,
	Helge Deller, dri-devel, linux-fbdev, linux-kernel,
	kernel-janitors

The "num_levels" variable is used to store error codes from
device_property_count_u32() so it needs to be signed.  This doesn't
cause an issue at runtime because devm_kcalloc() won't allocate negative
sizes.  However, it's still worth fixing.

Fixes: b54c828bdba9 ("backlight: mp3309c: Make use of device properties")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/video/backlight/mp3309c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c
index c80a1481e742..4e98e60417d2 100644
--- a/drivers/video/backlight/mp3309c.c
+++ b/drivers/video/backlight/mp3309c.c
@@ -205,8 +205,9 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip,
 				struct mp3309c_platform_data *pdata)
 {
 	int ret, i;
-	unsigned int num_levels, tmp_value;
+	unsigned int tmp_value;
 	struct device *dev = chip->dev;
+	int num_levels;
 
 	if (!dev_fwnode(dev))
 		return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n");
-- 
2.43.0


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

* Re: [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode()
  2024-03-16  9:45 [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode() Dan Carpenter
@ 2024-03-18 10:20 ` Andy Shevchenko
  2024-03-18 10:57 ` Daniel Thompson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-03-18 10:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Flavio Suligoi, Lee Jones, Daniel Thompson, Jingoo Han,
	Helge Deller, dri-devel, linux-fbdev, linux-kernel,
	kernel-janitors

On Sat, Mar 16, 2024 at 12:45:27PM +0300, Dan Carpenter wrote:
> The "num_levels" variable is used to store error codes from
> device_property_count_u32() so it needs to be signed.  This doesn't
> cause an issue at runtime because devm_kcalloc() won't allocate negative
> sizes.  However, it's still worth fixing.

Agree.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode()
  2024-03-16  9:45 [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode() Dan Carpenter
  2024-03-18 10:20 ` Andy Shevchenko
@ 2024-03-18 10:57 ` Daniel Thompson
  2024-03-18 11:18 ` FLAVIO SULIGOI
  2024-03-21 18:14 ` (subset) " Lee Jones
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Thompson @ 2024-03-18 10:57 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andy Shevchenko, Flavio Suligoi, Lee Jones, Jingoo Han,
	Helge Deller, dri-devel, linux-fbdev, linux-kernel,
	kernel-janitors

On Sat, Mar 16, 2024 at 12:45:27PM +0300, Dan Carpenter wrote:
> The "num_levels" variable is used to store error codes from
> device_property_count_u32() so it needs to be signed.  This doesn't
> cause an issue at runtime because devm_kcalloc() won't allocate negative
> sizes.  However, it's still worth fixing.
>
> Fixes: b54c828bdba9 ("backlight: mp3309c: Make use of device properties")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

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

* RE: [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode()
  2024-03-16  9:45 [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode() Dan Carpenter
  2024-03-18 10:20 ` Andy Shevchenko
  2024-03-18 10:57 ` Daniel Thompson
@ 2024-03-18 11:18 ` FLAVIO SULIGOI
  2024-03-21 18:14 ` (subset) " Lee Jones
  3 siblings, 0 replies; 5+ messages in thread
From: FLAVIO SULIGOI @ 2024-03-18 11:18 UTC (permalink / raw)
  To: 'Dan Carpenter', Andy Shevchenko
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller, dri-devel,
	linux-fbdev, linux-kernel, kernel-janitors

Hi Dan,

> The "num_levels" variable is used to store error codes from
> device_property_count_u32() so it needs to be signed.  This doesn't cause an
> issue at runtime because devm_kcalloc() won't allocate negative sizes.
> However, it's still worth fixing.
> 
> Fixes: b54c828bdba9 ("backlight: mp3309c: Make use of device properties")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

I've just tested on my board with the mp3309c chip, all is ok.
Thanks!

Tested-by: Flavio Suligoi <f.suligoi@asem.it>


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

* Re: (subset) [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode()
  2024-03-16  9:45 [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode() Dan Carpenter
                   ` (2 preceding siblings ...)
  2024-03-18 11:18 ` FLAVIO SULIGOI
@ 2024-03-21 18:14 ` Lee Jones
  3 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2024-03-21 18:14 UTC (permalink / raw)
  To: Andy Shevchenko, Dan Carpenter
  Cc: Flavio Suligoi, Lee Jones, Daniel Thompson, Jingoo Han,
	Helge Deller, dri-devel, linux-fbdev, linux-kernel,
	kernel-janitors

On Sat, 16 Mar 2024 12:45:27 +0300, Dan Carpenter wrote:
> The "num_levels" variable is used to store error codes from
> device_property_count_u32() so it needs to be signed.  This doesn't
> cause an issue at runtime because devm_kcalloc() won't allocate negative
> sizes.  However, it's still worth fixing.
> 
> 

Applied, thanks!

[1/1] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode()
      commit: 84a053e072c8aacff8074ac5d6f7a4e7ff745209

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2024-03-21 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-16  9:45 [PATCH] backlight: mp3309c: fix signedness bug in mp3309c_parse_fwnode() Dan Carpenter
2024-03-18 10:20 ` Andy Shevchenko
2024-03-18 10:57 ` Daniel Thompson
2024-03-18 11:18 ` FLAVIO SULIGOI
2024-03-21 18:14 ` (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.