[PATCH 2/9] ARM: at91 gpio: Fix possible null pointer dereference

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Apr 26 12:59:46 EDT 2013


On 20:41 Fri 26 Apr     , Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
> ---
>  arch/arm/mach-at91/gpio.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
> index c2618c7..0e39a52 100644
> --- a/arch/arm/mach-at91/gpio.c
> +++ b/arch/arm/mach-at91/gpio.c
> @@ -185,10 +185,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
>  int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
>  {
>  	struct at91_gpio_chip *at91_gpio = pin_to_controller(pin);
> -	void __iomem *pio = at91_gpio->regbase;
> +	void __iomem *pio;
> +	struct device_d *dev;
>  	unsigned mask = pin_to_mask(pin);
>  	int bank = pin_to_bank(pin);
> -	struct device_d *dev = at91_gpio->chip.dev;
so crash
>  
>  	if (!at91_gpio)
>  		return -EINVAL;
> @@ -197,6 +197,7 @@ int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
>  	if (!pio)
>  		return -EINVAL;
>  
> +	dev = at91_gpio->chip.dev;
>  	at91_mux_disable_interrupt(pio, mask);
>  
>  	pin %= MAX_NB_GPIO_PER_BANK;
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox



More information about the barebox mailing list