From patchwork Sat Nov 19 20:53:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 23331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp868677wrr; Sat, 19 Nov 2022 13:10:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HYLUaXJmVElZ+dBabA8NY/Anw8gIICGuG7n0wVmyFpioxHjspp6kPdE0aEkcgCmMcrfdz X-Received: by 2002:a17:906:5245:b0:7aa:97c7:2c05 with SMTP id y5-20020a170906524500b007aa97c72c05mr10357418ejm.367.1668892236785; Sat, 19 Nov 2022 13:10:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668892236; cv=none; d=google.com; s=arc-20160816; b=T4HLKsXjssgMLLfZWFOR8r4MayFGolS6WfcIw2lTOwhALtvN5U7lvNqmpARVqO/ZU9 sAbMqXiCBcOa3BEwpebPXk5TQVURkXDvKDsL/GFqnxCR65CZ30uYnkNdXLrw4O3h/ZIG WcTJ7f9E7KjTHSMqP8iWzD903WENYXYwadcr7CBWHXmEQsIPcfBdQJHCVZ1b9LxCbSzj k3KAd1xco8z3U9QC39IJirUYzvV7e/boXLntz8P40s8jPxfp1vgreXRh75y+Ty06FtMF phZJ6NGMlo5Pf7pGZ52dh9XPIWp1Jhv7gTDOPgQGhzElx8O+Irz/YYDv+y0nip/KwNOR pxKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=AhMRsM2VcgpSkSI9jOKkzyifus7vnIVEMwNmVQF0qwE=; b=mUvHQmUht3/3Qd8G3zAyYq8wcazj6rVmlVmz8It8jHgXvBPYoKsCJm+YfaFJDD2LIv d28BZsDcR63AbNuFYQ++JQI7bG3+MMV+TUhHjs4DHnFkTVqQqK2m0q30XjO1aMTea9UR 5pD0xXkaE0lA2JHHRlNA6mk2JhfaBqYIdsr+r8VM4zMczGzdOXuvLTvf4a8t6qJ84GiA NA3pnl2d240ZLuK4BEPAFVsGBZBGAjZbk6hY6echr0QAC1CTlSde055lEau4DOXZ3Hut l5Q+03Yor+5WpFpa1//ClfMEPrwTxQJAk3VxVlhZZPyVmrI55AR6MIX2GOOq9db6iRQN GhNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=dPP9A7lh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a170906794900b0079ddb52369bsi2033345ejo.61.2022.11.19.13.09.55; Sat, 19 Nov 2022 13:10:36 -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=fail header.i=@mailo.com header.s=mailo header.b=dPP9A7lh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235031AbiKSUxl (ORCPT + 99 others); Sat, 19 Nov 2022 15:53:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234895AbiKSUxi (ORCPT ); Sat, 19 Nov 2022 15:53:38 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322E126D9; Sat, 19 Nov 2022 12:53:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1668891195; bh=fw52bMqQOJVIoYoF40uODbxsnJEZGdDI7hukBF588KA=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; b=dPP9A7lh5/eSskwwh1iUAlYfE8bGp1mZXfKnZnc5Y1LbSENAM+qcZH27W/uvElmdS Zxec1UAca0RwVNLEVfRr7cC0qH7fDDymgVROFf8IqooQdquN7Nbqi0D6jV6ehffoC7 Ce+Y15v8pk+Dc40Z35PK8JAywLB/IjLuHYvXy3hQ= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 19 Nov 2022 21:53:15 +0100 (CET) X-EA-Auth: tzzRw3US9AUZnWPyLPpSKljBHOIlqB32lRdAQyZ6nFr5okiIoPGw/HnP9758E9uP3AasUQH9DK7Vq/WNRH+RH3PNRUU3uSGk Date: Sun, 20 Nov 2022 02:23:10 +0530 From: Deepak R Varma To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH] Bluetooth: hci_conn: Use kzalloc for kmalloc+memset Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749960346020191825?= X-GMAIL-MSGID: =?utf-8?q?1749960346020191825?= Use of kzalloc preferred over combination of kmalloc & memset. Issue identified using coccicheck. Signed-off-by: Deepak R Varma --- Notes: No changes. Just a gentle reminder for review and feedback. net/bluetooth/hci_conn.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.34.1 diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 7a59c4487050..287d313aa312 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -824,11 +824,10 @@ static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis) bt_dev_dbg(hdev, "big 0x%2.2x bis 0x%2.2x", big, bis); - d = kmalloc(sizeof(*d), GFP_KERNEL); + d = kzalloc(sizeof(*d), GFP_KERNEL); if (!d) return -ENOMEM; - memset(d, 0, sizeof(*d)); d->big = big; d->bis = bis; @@ -861,11 +860,10 @@ static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle) bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big, sync_handle); - d = kmalloc(sizeof(*d), GFP_KERNEL); + d = kzalloc(sizeof(*d), GFP_KERNEL); if (!d) return -ENOMEM; - memset(d, 0, sizeof(*d)); d->big = big; d->sync_handle = sync_handle;