* [PATCH] power: supply: Added check for negative values
@ 2022-11-17 12:01 Denis Arefev
2022-11-17 22:45 ` Sebastian Reichel
0 siblings, 1 reply; 5+ messages in thread
From: Denis Arefev @ 2022-11-17 12:01 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Chen-Yu Tsai, Hans de Goede, linux-pm, linux-kernel, lvc-patches,
trufanov, vfh
Variable 'pirq', which may receive negative value
in platform_get_irq().
Used as an index in a function regmap_irq_get_virq().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/power/supply/axp288_fuel_gauge.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index 148eb8105803..36c7039c99c2 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
pirq = platform_get_irq(info->pdev, i);
+ if (pirq < 0)
+ continue;
info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
if (info->irq[i] < 0) {
dev_warn(&info->pdev->dev,
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] power: supply: Added check for negative values
2022-11-17 12:01 [PATCH] power: supply: Added check for negative values Denis Arefev
@ 2022-11-17 22:45 ` Sebastian Reichel
0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2022-11-17 22:45 UTC (permalink / raw)
To: Denis Arefev
Cc: Chen-Yu Tsai, Hans de Goede, linux-pm, linux-kernel, lvc-patches,
trufanov, vfh
[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]
Hi,
On Thu, Nov 17, 2022 at 03:01:40PM +0300, Denis Arefev wrote:
> Variable 'pirq', which may receive negative value
> in platform_get_irq().
> Used as an index in a function regmap_irq_get_virq().
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
The patch does not apply. Looks like the patch is based against
ancient code (pre 2022). Also the patch subject prefix should be
'power: supply: axp288_fuel_gauge:'
Thanks,
-- Sebastian
> drivers/power/supply/axp288_fuel_gauge.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
> index 148eb8105803..36c7039c99c2 100644
> --- a/drivers/power/supply/axp288_fuel_gauge.c
> +++ b/drivers/power/supply/axp288_fuel_gauge.c
> @@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
>
> for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
> pirq = platform_get_irq(info->pdev, i);
> + if (pirq < 0)
> + continue;
> info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
> if (info->irq[i] < 0) {
> dev_warn(&info->pdev->dev,
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] power: supply: Added check for negative values
2022-12-06 17:11 ` Hans de Goede
@ 2023-01-02 22:19 ` Sebastian Reichel
0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2023-01-02 22:19 UTC (permalink / raw)
To: Hans de Goede
Cc: Denis Arefev, Chen-Yu Tsai, linux-pm, linux-kernel, lvc-project,
trufanov, vfh
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]
Hi,
On Tue, Dec 06, 2022 at 06:11:23PM +0100, Hans de Goede wrote:
> Hi,
>
> On 12/6/22 10:17, Denis Arefev wrote:
> > Variable 'pirq', which may receive negative value
> > in platform_get_irq().
> > Used as an index in a function regmap_irq_get_virq().
> >
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> >
> > Signed-off-by: Denis Arefev <arefev@swemel.ru>
>
> Thanks, patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>
> Regards,
>
> Hans
Thanks, queued to power-supply's fixes branch.
-- Sebastian
>
> > ---
> > drivers/power/supply/axp288_fuel_gauge.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
> > index 148eb8105803..36c7039c99c2 100644
> > --- a/drivers/power/supply/axp288_fuel_gauge.c
> > +++ b/drivers/power/supply/axp288_fuel_gauge.c
> > @@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
> >
> > for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
> > pirq = platform_get_irq(info->pdev, i);
> > + if (pirq < 0)
> > + continue;
> > info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
> > if (info->irq[i] < 0) {
> > dev_warn(&info->pdev->dev,
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] power: supply: Added check for negative values
2022-12-06 9:17 Denis Arefev
@ 2022-12-06 17:11 ` Hans de Goede
2023-01-02 22:19 ` Sebastian Reichel
0 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2022-12-06 17:11 UTC (permalink / raw)
To: Denis Arefev, Sebastian Reichel
Cc: Chen-Yu Tsai, linux-pm, linux-kernel, lvc-project, trufanov, vfh
Hi,
On 12/6/22 10:17, Denis Arefev wrote:
> Variable 'pirq', which may receive negative value
> in platform_get_irq().
> Used as an index in a function regmap_irq_get_virq().
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/power/supply/axp288_fuel_gauge.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
> index 148eb8105803..36c7039c99c2 100644
> --- a/drivers/power/supply/axp288_fuel_gauge.c
> +++ b/drivers/power/supply/axp288_fuel_gauge.c
> @@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
>
> for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
> pirq = platform_get_irq(info->pdev, i);
> + if (pirq < 0)
> + continue;
> info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
> if (info->irq[i] < 0) {
> dev_warn(&info->pdev->dev,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] power: supply: Added check for negative values
@ 2022-12-06 9:17 Denis Arefev
2022-12-06 17:11 ` Hans de Goede
0 siblings, 1 reply; 5+ messages in thread
From: Denis Arefev @ 2022-12-06 9:17 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Chen-Yu Tsai, Hans de Goede, linux-pm, linux-kernel, lvc-project,
trufanov, vfh
Variable 'pirq', which may receive negative value
in platform_get_irq().
Used as an index in a function regmap_irq_get_virq().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/power/supply/axp288_fuel_gauge.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index 148eb8105803..36c7039c99c2 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
pirq = platform_get_irq(info->pdev, i);
+ if (pirq < 0)
+ continue;
info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
if (info->irq[i] < 0) {
dev_warn(&info->pdev->dev,
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-02 22:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 12:01 [PATCH] power: supply: Added check for negative values Denis Arefev
2022-11-17 22:45 ` Sebastian Reichel
2022-12-06 9:17 Denis Arefev
2022-12-06 17:11 ` Hans de Goede
2023-01-02 22:19 ` Sebastian Reichel
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).