Re: [PATCH] thermal: Fix for setting the thermal zone mode to enable/disable

From: Geert Uytterhoeven
Date: Wed Mar 21 2012 - 11:14:46 EST


On Wed, Mar 21, 2012 at 15:13, Jean Delvare <khali@xxxxxxxxxxxx> wrote:
> On Wed, 21 Mar 2012 16:40:01 +0530, Amit Daniel Kachhap wrote:
>> Basically without this patch changing the mode of thermal zone
>> is not possible as wrong string size is passed to strncmp.
>
> Actually it is possible,
> $ echo -n disabled > mode
> works fine. But it fails without the -n, your patch would fix that.

Now it ignores any extra characters. Are they always newlines?

Now "echo -n disabledx > mode" will also "succeed".

> Acked-by: Jean Delvare <khali@xxxxxxxxxxxx>
>
> Note that a quick grep suggests that drivers/misc/ad525x_dpot.c,
> security/selinux/hooks.c and arch/m68k/sun3/prom/console.c suffer from
> the same issue, if you want to fix them too.

W.r.t. the Sun-3 code, those strings don't come from the user, but from the
firmware. But the code (copied from SPARC, which has the right firmware,
unlike Sun-3) is commented out anyway.

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/