Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1312891 > unrolled thread

[PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify()

Started byKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
First post2016-01-20 06:50 +0100
Last post2016-01-20 08:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify() Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - 2016-01-20 06:50 +0100
    Re: [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-01-20 08:10 +0100

#1312891 — [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify()

FromKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date2016-01-20 06:50 +0100
Subject[PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify()
Message-ID<qSTOy-25l-3@gated-at.bofh.it>
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

It needs to check maximum trip size before using it.
Otherwise, each driver might be called with unsupported trip.

Reported-by: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/thermal_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 7f7a3ca..9761f49 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -461,6 +461,9 @@ static void thermal_tripped_notify(struct thermal_zone_device *tz,
 		kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg);
 	}
 
+	if (tz->trips <= trip + 1)
+		goto unlock;
+
 	ret = tz->ops->get_trip_temp(tz, trip + 1, &upper_trip_temp);
 	if (ret)
 		goto unlock;
-- 
1.9.1

[toc] | [next] | [standalone]


#1312941

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2016-01-20 08:10 +0100
Message-ID<qSV3X-35h-11@gated-at.bofh.it>
In reply to#1312891
Hi Morimoto-san,

On Wed, Jan 20, 2016 at 6:45 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> It needs to check maximum trip size before using it.
> Otherwise, each driver might be called with unsupported trip.
>
> Reported-by: Magnus Damm <magnus.damm@gmail.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/thermal/thermal_core.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 7f7a3ca..9761f49 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -461,6 +461,9 @@ static void thermal_tripped_notify(struct thermal_zone_device *tz,
>                 kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg);
>         }
>
> +       if (tz->trips <= trip + 1)
> +               goto unlock;
> +

Thanks, I assume this will fix the "rcar_thermal e61f0000.thermal: rcar
driver trip error" messages.

However, I don't know if it's the right fix, cfr. my unanswered question at
https://lkml.org/lkml/2016/1/5/107

>         ret = tz->ops->get_trip_temp(tz, trip + 1, &upper_trip_temp);
>         if (ret)
>                 goto unlock;
> --
> 1.9.1

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web