From patchwork Sun Jul 24 20:22:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9245041 X-Patchwork-Delegate: kvalo@adurom.com 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 7DCA360487 for ; Sun, 24 Jul 2016 20:22:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E6F625819 for ; Sun, 24 Jul 2016 20:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 631CE262FF; Sun, 24 Jul 2016 20:22:35 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04B9B25819 for ; Sun, 24 Jul 2016 20:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752476AbcGXUWR (ORCPT ); Sun, 24 Jul 2016 16:22:17 -0400 Received: from mout.web.de ([212.227.15.4]:64676 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752005AbcGXUWP (ORCPT ); Sun, 24 Jul 2016 16:22:15 -0400 Received: from [192.168.1.2] ([78.48.64.218]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0LiUZg-1atTCu2KcO-00chDN; Sun, 24 Jul 2016 22:22:08 +0200 Subject: [PATCH 2/3] staging: wilc1000: One function call less in mac_ioctl() after error detection To: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Austin Shin , Chris Park , Glen Lee , Greg Kroah-Hartman , Johnny Kim , Leo Kim , Tony Cho References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <558EB32E.6090003@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <590e0614-db41-a193-5463-9e3ad2630489@users.sourceforge.net> Date: Sun, 24 Jul 2016 22:22:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:1aVjwXnrh31r3UxmzgJ+WeaHy6YpPpYTymyJI6Ey6OTnWzEDTQ7 mrDhldwXzmoGOSw+ArPGqX2SGk4WA5mUT4Dt6iWn5KLNrdkn6AzPUp+pjtT2SG+h29MjBop AtHmb7TGOBMoktF1pZuiIuiODk4PUB3v1UwyJzv6HFF7NjpgoH50Va0tiqF+VRricNuyvEu VsjOUyiEIctJW+Vi0cciQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:TIMzHT54SQo=:MLi8wzxBKh2T7Kn+OCDPYn 0HII9ieXukN6WiaSnaI/4w+EWnAKWJ4uLFoFEBPrPHh6UJROCn+vB88glDgBlfODJxD0sq5i6 +vdwLj+B0mF3xaheVg30fnJCBVZrB/Ne0UhciVP/PJzK+0UZBUKHaz3LMalilTAqXVYIE1KQx sfIOf/IalVfePeGZ/FV/WdVfr6EnzqNj6T3EStZjCjVEC+T7YxPvK3LygX3H0FRNoOaSSJzer xV5aCUK4OS0Kw+AcIXsXB/AlZW5RwlfvQA9pah+ucI/0MpQD3FBG6lrZ6nHcFs8TYMmeDmu/8 n4K6Q3Z4rlpijw/5JXWgCkjjsGL9T4UqqAqgQea3bItxN6I2szNOq4cpWzg4Pu5bg04uHWad1 6MJCRAF0HpCvhdotJuP/0C87I53s7u1DbvAq7W30TvOX3hvyxr1qoLJnnZhNnOAmyjBO5roJ4 tyLgrzNlFvwWZYDf/5UmRsZuog6lWtdBLPRXnAnSIKV5egg2/RY5wNpvGkm166bJx7/ASQgFe 9L/n+1Tcuba6mDnGzr0MIPPwCLIJ0HjsI8H1Hj8q8+sZRblEizSP7gO7jJO6S+hpzkyBAtCX5 qKZHAfW97n8lEHZ7TzthCQPFVNUfo+NIltl/s35sV3XgEJ545Np+x7Npne66ErcyXYygAAgMC 5lC1DcPvwquxGOpgvXTu/rdPKRTxHmXHWnBnrYlpYsNQyz/xGaXD4SDlI5rJpIc8UW1WVRB6Y k3/Q6tKKvDfRFRSf0IhirsHbrNqermb3UWAHiq0c486wAAJmXhRSp1B2U69aDyFGF9xPzu85x 4aoO+9M Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 24 Jul 2016 21:15:23 +0200 The kfree() function was called in two cases by the mac_ioctl() function during error handling even if the passed variable did not contain a pointer for a valid data item. Improve this implementation detail by the introduction of another jump label. Signed-off-by: Markus Elfring --- drivers/staging/wilc1000/linux_wlan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index cdef645..7b1ebcc 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1130,7 +1130,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (copy_to_user(wrq->u.data.pointer, buff, size)) { netdev_err(ndev, "failed to copy\n"); ret = -EFAULT; - goto done; + goto free_buffer; } } } @@ -1144,11 +1144,9 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) goto done; } } - -done: - +free_buffer: kfree(buff); - +done: return ret; }