Re: [PATCH] regulator: max77686: fix gpio_enabled shift wrapping bug

From: Krzysztof Kozlowski
Date: Mon May 18 2015 - 20:16:37 EST


On 19.05.2015 02:01, Joe Perches wrote:
> The code should handle more than 32 bits here because "id"
> can be a value up to MAX77686_REGULATORS (currently 34).
>
> Convert the gpio_enabled type to DECLARE_BITMAP and use
> test_bit/set_bit.
>
> Fixes: 3307e9025d29 ("regulator: max77686: Add GPIO control")
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
Tested-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>

Again - why you do not add CC-stable? If you need observational bug
effect to the commit message you can add:

<<When max77686 regulator was configured to GPIO controlled mode, the
overflow of 32 bit regulator ID could switch off completely different
regulators. This could happen because for other regulators the value of
"GPIO controlled mode" means "disabled".>>

Although I did not saw such effect of overflow in testing, it actually
should happen looking at the code.

Best regards,
Krzysztof

--
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/