* [PATCH] pwm: lp3943: Fix signedness bug in lp3943_pwm_parse_dt()
@ 2024-08-12 6:43 Dan Carpenter
2024-09-03 16:48 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-08-12 6:43 UTC (permalink / raw)
To: Rob Herring
Cc: Uwe Kleine-König, linux-pwm, linux-kernel, kernel-janitors
The "num_outputs" variable needs to be signed for the error checking for
of_property_count_u32_elems() to work correctly. If the property is not
present then we're supposed to continue, but in the current code we will
try to allocate negative bytes, which will fail and it returns -ENOMEM.
Fixes: d6a56f3bb650 ("pwm: lp3943: Use of_property_count_u32_elems() to get property length")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/pwm/pwm-lp3943.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
index f0e94c9e5956..803ecd6435cc 100644
--- a/drivers/pwm/pwm-lp3943.c
+++ b/drivers/pwm/pwm-lp3943.c
@@ -219,7 +219,7 @@ static int lp3943_pwm_parse_dt(struct device *dev,
struct lp3943_pwm_map *pwm_map;
enum lp3943_pwm_output *output;
int i, err, count = 0;
- u32 num_outputs;
+ int num_outputs;
if (!node)
return -EINVAL;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] pwm: lp3943: Fix signedness bug in lp3943_pwm_parse_dt()
2024-08-12 6:43 [PATCH] pwm: lp3943: Fix signedness bug in lp3943_pwm_parse_dt() Dan Carpenter
@ 2024-09-03 16:48 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2024-09-03 16:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Rob Herring, linux-pwm, linux-kernel, kernel-janitors,
Jiapeng Chong, Trevor Gamblin
[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]
On Mon, Aug 12, 2024 at 09:43:11AM +0300, Dan Carpenter wrote:
> The "num_outputs" variable needs to be signed for the error checking for
> of_property_count_u32_elems() to work correctly. If the property is not
> present then we're supposed to continue, but in the current code we will
> try to allocate negative bytes, which will fail and it returns -ENOMEM.
>
> Fixes: d6a56f3bb650 ("pwm: lp3943: Use of_property_count_u32_elems() to get property length")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/pwm/pwm-lp3943.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
> index f0e94c9e5956..803ecd6435cc 100644
> --- a/drivers/pwm/pwm-lp3943.c
> +++ b/drivers/pwm/pwm-lp3943.c
> @@ -219,7 +219,7 @@ static int lp3943_pwm_parse_dt(struct device *dev,
> struct lp3943_pwm_map *pwm_map;
> enum lp3943_pwm_output *output;
> int i, err, count = 0;
> - u32 num_outputs;
> + int num_outputs;
>
> if (!node)
> return -EINVAL;
This issue is fixed since next-20240812 with the similar commit
adef9a535479 ("pwm: lp3943: Fix an incorrect type in
lp3943_pwm_parse_dt()"). (Up to next-20240830 the commit id was
861a4272660a, I rewrote that commit because I got the Fixes line wrong.)
For this reason I marked this patch as "Not Applicable" in patchwork.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-03 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-12 6:43 [PATCH] pwm: lp3943: Fix signedness bug in lp3943_pwm_parse_dt() Dan Carpenter
2024-09-03 16:48 ` Uwe Kleine-König
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®