From patchwork Fri Mar 30 06:32:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10317017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 365F560212 for ; Fri, 30 Mar 2018 06:33:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28A1E2A42D for ; Fri, 30 Mar 2018 06:33:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D2E62A470; Fri, 30 Mar 2018 06:33:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 4CC182A42D for ; Fri, 30 Mar 2018 06:33:11 +0000 (UTC) Received: (qmail 7271 invoked by uid 550); 30 Mar 2018 06:33:09 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 7251 invoked from network); 30 Mar 2018 06:33:09 -0000 X-IronPort-AV: E=Sophos;i="5.48,380,1517871600"; d="scan'208";a="260356484" Date: Fri, 30 Mar 2018 08:32:56 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Laura Abbott cc: Linus Walleij , kbuild-all@01.org, Kees Cook , Lukas Wunner , Laura Abbott , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Rasmus Villemoes Subject: [PATCH] gpio: fix ifnullfree.cocci warnings (fwd) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP From: Fengguang Wu NULL check before kfree is not needed. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: ad85ae608fe0 ("gpio: Remove VLA from gpiolib") CC: Laura Abbott Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- url: https://github.com/0day-ci/linux/commits/Laura-Abbott/gpio-Remove-VLA-from-gpiolib/20180330-065639 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next gpiolib.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2758,8 +2758,7 @@ int gpiod_get_array_value_complex(bool r ret = gpio_chip_get_multiple(chip, mask, bits); if (ret) { - if (slowpath) - kfree(slowpath); + kfree(slowpath); return ret; } @@ -2774,8 +2773,7 @@ int gpiod_get_array_value_complex(bool r trace_gpio_value(desc_to_gpio(desc), 1, value); } - if (slowpath) - kfree(slowpath); + kfree(slowpath); } return 0; } @@ -3020,8 +3018,7 @@ int gpiod_set_array_value_complex(bool r if (count != 0) gpio_chip_set_multiple(chip, mask, bits); - if (slowpath) - kfree(slowpath); + kfree(slowpath); } return 0; }