Re: [PATCH v2] mmc: sunxi: Prevent against null dereference for vmmc
From: Chen-Yu Tsai
Date: Thu Oct 20 2016 - 22:52:52 EST
On Wed, Oct 19, 2016 at 9:33 PM, Maxime Ripard
<maxime.ripard@xxxxxxxxxxxxxxxxxx> wrote:
> VMMC is an optional regulator, which means that mmc_regulator_get_supply
> will only return an error in case of a deferred probe, but not when the
> regulator is not set in the DT.
>
> However, the sunxi driver assumes that VMMC is always there, and doesn't
> check the value of the regulator pointer before using it, which obviously
> leads to a (close to) null pointer dereference.
>
> Add proper checks to prevent that.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@xxxxxxxxxxxxxxxxxx>
Acked-by: Chen-Yu Tsai <wens@xxxxxxxx>