Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1606003pxp; Sat, 12 Mar 2022 15:41:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/amrqrXe14bDEDd4IKrhiwFXBIal5LCIzSQg/rjtrJVt6yOR/k2svN2UarhuAceZsERz7 X-Received: by 2002:a17:907:a424:b0:6db:b16:1e41 with SMTP id sg36-20020a170907a42400b006db0b161e41mr14706337ejc.458.1647128489442; Sat, 12 Mar 2022 15:41:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647128489; cv=none; d=google.com; s=arc-20160816; b=PoepYg0I5FCkqY4PtakQX4nOVurpYMPEIUrIKjGNuckjCk4K0kJzSm5vdAR2PJtcI3 Lll1QeFVfLspGAdqL6Iy763Ax8hazLyIL5jGZYGm/tdPOGxhqmKYXRTQvzi9XYH1Cw+6 5EEcjh3In4j06MBixps6FnKal09cGcPlUgM1Hn8xOrRHfkqsmXtTd9V9L+0Ks567i34Q MINm6lvM011niOEnom8w6EowYa7++bloQC2721P0o+0VEVW5SuYMMiVsn9oDYKGJA6U0 7q7BZ50D+EUoeZgAkPzwLermo4faUs6Yhc61aM7d2+NCHanXftYsfLQmeiSCLQtimVR2 YCTg== 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=stEf22hi8ODEHQdWrg8iLu47DwcXnuaCT7isJzYDhRA=; b=QgYtXJY4ghNWEEjmuj1MoqPHBFrwxBdPBcM+QwLmqsC99V0DD6Zq5N9SF0jO9Gv8aq xl3E29vPOhdCa0+46t/LZotyJ+10uq4VHbMDORLPLUKNHnXIbwVUpAB+OsXfLrqMOdxe g+YgU3V0yWXrElN6skq3VTXsyTD/F9VptsBe2/ME+ZNeHXENynupf00UoAF4rftmiVIS kA0a1xLpS36hBnn9QWQOKZ0gH0NxXJ8kEbpCOtcrg3sw/xB+BohozWXfZPBYOdWlgFKc lUfbs6325RjqcElWmtj3ZVASRBc5cxyDKcHC2sPqRdlFTHAOwOLheWp8Uzze+zOhvsak 6BjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=deEbcJzg; 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 z13-20020a1709060acd00b006d6e5846a2csi6892628ejf.740.2022.03.12.15.41.05; Sat, 12 Mar 2022 15:41:29 -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=deEbcJzg; 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 S231147AbiCLK2n (ORCPT + 99 others); Sat, 12 Mar 2022 05:28:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231758AbiCLK2Z (ORCPT ); Sat, 12 Mar 2022 05:28:25 -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 7C2151E6951; Sat, 12 Mar 2022 02:27:19 -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=stEf22hi8ODEHQdWrg8iLu47DwcXnuaCT7isJzYDhRA=; b=deEbcJzgiOY2sCecLvFUg44QLuAtr9BErJnFjjX61WzAxxWAD+qCeUaH z2Mz+OTRc86RDPtIsNA3EKoZAcwkC4E9EmcruQilgOLprVgF2A+e8qBFr UbuP2lZhs94moodfwUuMtou2gQ9YUCOzNrNKogsYJk3QF8tsoxBpkHj4d 0=; 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="25781352" 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: Andrey Konovalov Cc: kernel-janitors@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] usb: raw-gadget: use kzalloc Date: Sat, 12 Mar 2022 11:27:05 +0100 Message-Id: <20220312102705.71413-7-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/usb/gadget/legacy/raw_gadget.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c index d86c3a36441e..135e75b891f6 100644 --- a/drivers/usb/gadget/legacy/raw_gadget.c +++ b/drivers/usb/gadget/legacy/raw_gadget.c @@ -1157,7 +1157,7 @@ static int raw_ioctl_eps_info(struct raw_dev *dev, unsigned long value) struct usb_raw_eps_info *info; struct raw_ep *ep; - info = kmalloc(sizeof(*info), GFP_KERNEL); + info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { ret = -ENOMEM; goto out; @@ -1177,7 +1177,6 @@ static int raw_ioctl_eps_info(struct raw_dev *dev, unsigned long value) goto out_free; } - memset(info, 0, sizeof(*info)); for (i = 0; i < dev->eps_num; i++) { ep = &dev->eps[i]; strscpy(&info->eps[i].name[0], ep->ep->name,