Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751783AbbLNOQa (ORCPT ); Mon, 14 Dec 2015 09:16:30 -0500 Received: from www.osadl.org ([62.245.132.105]:42520 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525AbbLNOQ1 (ORCPT ); Mon, 14 Dec 2015 09:16:27 -0500 X-Greylist: delayed 3031 seconds by postgrey-1.27 at vger.kernel.org; Mon, 14 Dec 2015 09:16:26 EST From: Nicholas Mc Guire To: Michael Turquette Cc: Stephen Boyd , Geert Uytterhoeven , Sebastian Hesselbarth , Heiko Stuebner , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] clk: unchecked return of kmalloc_array Date: Mon, 14 Dec 2015 14:16:55 +0100 Message-Id: <1450099015-23148-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1258 Lines: 38 kmalloc_array return is unchecked - given how parent_names is being treated in case of allocation error it probably is ok to treat clock->parents the same way and simply return. problem was located with coccinelle Signed-off-by: Nicholas Mc Guire --- patch was compile tested for shmobile_defconfig (implies CONFIG_ARCH_SHMOBILE_MULTI=y) patch is against linux-next (localversion-next -next-20151214) drivers/clk/shmobile/clk-div6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/shmobile/clk-div6.c b/drivers/clk/shmobile/clk-div6.c index b4c8d67..e6b7533 100644 --- a/drivers/clk/shmobile/clk-div6.c +++ b/drivers/clk/shmobile/clk-div6.c @@ -196,6 +196,8 @@ static void __init cpg_div6_clock_init(struct device_node *np) clock->parents = kmalloc_array(num_parents, sizeof(*clock->parents), GFP_KERNEL); + if (!clock->parents) + return; parent_names = kmalloc_array(num_parents, sizeof(*parent_names), GFP_KERNEL); if (!parent_names) -- 1.7.10.4 -- 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/