Message ID | 1401445252-21413-1-git-send-email-sachin.kamat@linaro.org |
---|---|
State | Accepted |
Commit | bd07894e217b174361711320be50c8308456096d |
Headers | show |
On Fri, May 30, 2014 at 03:50:52PM +0530, Sachin Kamat wrote: > kzalloc can fail. Add a null check to avoid null pointer > dereference error while accessing the pointer later. > > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Thanks! Maxime
On Fri, May 30, 2014 at 12:20 PM, Sachin Kamat <sachin.kamat@linaro.org> wrote: > kzalloc can fail. Add a null check to avoid null pointer > dereference error while accessing the pointer later. > > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Patch applied for fixes with Maxime's ACK. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index f1ca75e6d7b1..5f38c7f67834 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -211,6 +211,10 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, configlen++; pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); + if (!pinconfig) { + kfree(*map); + return -ENOMEM; + } if (!of_property_read_u32(node, "allwinner,drive", &val)) { u16 strength = (val + 1) * 10;
kzalloc can fail. Add a null check to avoid null pointer dereference error while accessing the pointer later. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 4 ++++ 1 file changed, 4 insertions(+)