Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1245049pxp; Sat, 12 Mar 2022 05:31:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwktsBTjQX10wwcVbPWwdXdixP39lbsG+wVZYRp9uOibI5/C2r/u5wzoq5d8ni4B+uYNOxj X-Received: by 2002:a17:906:d29b:b0:6da:9e4d:bb7c with SMTP id ay27-20020a170906d29b00b006da9e4dbb7cmr12675585ejb.155.1647091883998; Sat, 12 Mar 2022 05:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647091883; cv=none; d=google.com; s=arc-20160816; b=pz7ydUPPZFkWAxhaV3dkZk8TK+L0PRyE/XOZxdujtb9C12jbN4/BBg1vDUsAKvTcs+ Gb2nAA1UUufWO07I4puY8sYHIb8/AHAqzL+jf9EjtCFYTaxY6JLY2fAJinh/VtOrRz4I /7ZSM0RmsThIbf1QL5cb3k9Upx/bwUcIVjdJ5v7RcojYwvBE7CBLALL8gcyfUBAjI5yF /u5MOirF1lgUZKHAPUYRciYsx48GUe3dgTLw1xRtvx7fqTlOeLFp6uw1WAx5TQ/QScv9 +sEtQgzfJ21uu53RTrbBEdZ4lxhJHipEaRWHXGl0xcHbdZz7XJtsBwma+4TnA3U7kqH0 rHPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E22sNuoFdaUOS4+WwLkXyv8STbZDc50AAO8Dj225850=; b=s8YD9UsL7Xr0+Y5GeW0fwdXbrs2LSmsb0i+sbRoDv12VpWJBuFWk6rYxqfpDKPXkQd NaewNjTjg6oyhY7Bvk2rlNZJVHg9Y5IaSotfCwbPMCIs8nqB2qR+0Gbqu0aV+EmHiuRE js0UZflmH/53KC91pooGak9YQwX0M/13mjcKQIlsMzcA2Ua0J7in/VlbjUVV7YMzA2u5 rBJ+R6gPZiWeQpOK+LeuKif4+S3TMNXAirF1uXZN2/VYIrhKgqvbjfBxblxWyENZhzw3 eAsLTD61DT0UgjTOtygNazF/4s1zk2gE+vxFdaARxyz7kO7cuNHtexZfetFVGoPPtgNK P4vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=ihL6Xsak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc10-20020a1709078a0a00b006ce0e15899esi7215460ejc.680.2022.03.12.05.30.59; Sat, 12 Mar 2022 05:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=ihL6Xsak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231779AbiCLK21 (ORCPT + 99 others); Sat, 12 Mar 2022 05:28:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbiCLK2W (ORCPT ); Sat, 12 Mar 2022 05:28:22 -0500 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C89A1E6951; Sat, 12 Mar 2022 02:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E22sNuoFdaUOS4+WwLkXyv8STbZDc50AAO8Dj225850=; b=ihL6XsakQk6+pfogM7zSLsmG19WLigBxJRkJgmSwuffhYtEaSzep0klY QFHKPcST9D03gZdcVWLX4I24nZEdikdu/p7Qwm1jDC9aVN85Rpqfphn9T A0F3ENhgKUCkb74WcGH1PiiJ8q7akjDZeB8G7aZa7r6B1KBQi0yLCLpQ2 M=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.90,175,1643670000"; d="scan'208";a="25781348" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2022 11:27:11 +0100 From: Julia Lawall To: Tariq Toukan Cc: kernel-janitors@vger.kernel.org, "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] net/mlx4_en: use kzalloc Date: Sat, 12 Mar 2022 11:27:01 +0100 Message-Id: <20220312102705.71413-3-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220312102705.71413-1-Julia.Lawall@inria.fr> References: <20220312102705.71413-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kzalloc instead of kmalloc + memset. The semantic patch that makes this change is: (https://coccinelle.gitlabpages.inria.fr/website/) // @@ expression res, size, flag; @@ - res = kmalloc(size, flag); + res = kzalloc(size, flag); ... - memset(res, 0, size); // Signed-off-by: Julia Lawall --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 8cfc649f226b..8f762fc170b3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -1067,7 +1067,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn, struct mlx4_qp_context *context; int err = 0; - context = kmalloc(sizeof(*context), GFP_KERNEL); + context = kzalloc(sizeof(*context), GFP_KERNEL); if (!context) return -ENOMEM; @@ -1078,7 +1078,6 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn, } qp->event = mlx4_en_sqp_event; - memset(context, 0, sizeof(*context)); mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0, qpn, ring->cqn, -1, context); context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);