Re: [PATCH v1] pinctrl: ralink: rt2880: Check for return value of devm_kcalloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 29, 2022 at 11:36 AM QintaoShen <unSimple1993@xxxxxxx> wrote:
>
> The memory allocation function devm_kcalloc() may return NULL pointer,

may --> might

> so it is better to add a check for 'p->func[i]->pins' to avoid possible
> NULL pointer dereference.

...

> @@ -266,6 +266,10 @@ static int rt2880_pinmux_pins(struct rt2880_priv *p)
>                                                 p->func[i]->pin_count,
>                                                 sizeof(int),
>                                                 GFP_KERNEL);

> +

Stray change. Also it seems it has trailing space character(s).

> +        if (!p->func[i]->pins)

> +            continue;

Why is 'continue' the proper choice here? No clarification is given in
the commit message.

>                 for (j = 0; j < p->func[i]->pin_count; j++)
>                         p->func[i]->pins[j] = p->func[i]->pin_first + j;

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux