From patchwork Wed Mar 3 02:40:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junlin Yang X-Patchwork-Id: 12114679 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66750C43603 for ; Thu, 4 Mar 2021 00:09:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 404BF64F8C for ; Thu, 4 Mar 2021 00:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354435AbhCDAIm (ORCPT ); Wed, 3 Mar 2021 19:08:42 -0500 Received: from m12-15.163.com ([220.181.12.15]:55473 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355566AbhCCGtM (ORCPT ); Wed, 3 Mar 2021 01:49:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Y5I94 cTExtGaMRThkHngPoCwB3fvdKWQc1AhklMV9I4=; b=Ne5cucJzNtpXb3PgIB1gz /fj3MySWqIocJgPjtNrLbZEX4oEzOYTzuaBLZxvjU0O4sQLG90VPdZ93t0sCCfQB NZx2m8DTDJDW2h8FUcN2Z9DeRBO0SNrN3xKI5x7/mE6XB/gwowtT+t4twomjkcLe L3SLppNhUyIFZ6z5HrLd14= Received: from yangjunlin.ccdomain.com (unknown [218.17.89.92]) by smtp11 (Coremail) with SMTP id D8CowAAnrAgU+D5g9HhoDg--.49S2; Wed, 03 Mar 2021 10:44:47 +0800 (CST) From: angkery To: saeedm@nvidia.com, leon@kernel.org, davem@davemloft.net, kuba@kernel.org, vladbu@nvidia.com, dlinkin@nvidia.com, roid@nvidia.com, dan.carpenter@oracle.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Junlin Yang Subject: [PATCH] net/mlx5: use kvfree() for memory allocated with kvzalloc() Date: Wed, 3 Mar 2021 10:40:19 +0800 Message-Id: <20210303024019.2245-1-angkery@163.com> X-Mailer: git-send-email 2.24.0.windows.2 MIME-Version: 1.0 X-CM-TRANSID: D8CowAAnrAgU+D5g9HhoDg--.49S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7WF13Xw1DGr4kAryrtryrWFg_yoW8XrWxpF s8K34jkr1Sqa47X34kA395Xr98Wa1UKayxur92v3yfXrn5Jw18JF1Fkry3uw18ArWxJasx tr4Yyw1fuaykJwUanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bO1v3UUUUU= X-Originating-IP: [218.17.89.92] X-CM-SenderInfo: 5dqjyvlu16il2tof0z/1tbiLR9KI1SIlJvXtgAAsp Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Junlin Yang It is allocated with kvzalloc(), the corresponding release function should not be kfree(), use kvfree() instead. Generated by: scripts/coccinelle/api/kfree_mismatch.cocci Signed-off-by: Junlin Yang Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c index 6f6772b..3da7bec 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c @@ -248,7 +248,7 @@ static int mlx5_esw_indir_table_rule_get(struct mlx5_eswitch *esw, err_ethertype: kfree(rule); out: - kfree(rule_spec); + kvfree(rule_spec); return err; } @@ -328,7 +328,7 @@ static int mlx5_create_indir_recirc_group(struct mlx5_eswitch *esw, e->recirc_cnt = 0; out: - kfree(in); + kvfree(in); return err; } @@ -347,7 +347,7 @@ static int mlx5_create_indir_fwd_group(struct mlx5_eswitch *esw, spec = kvzalloc(sizeof(*spec), GFP_KERNEL); if (!spec) { - kfree(in); + kvfree(in); return -ENOMEM; } @@ -371,8 +371,8 @@ static int mlx5_create_indir_fwd_group(struct mlx5_eswitch *esw, } err_out: - kfree(spec); - kfree(in); + kvfree(spec); + kvfree(in); return err; }