Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2401556rwb; Fri, 11 Nov 2022 08:49:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6y5yJ92uKTm9osqfY/pRhBku1buI3xlUiiPASO5Y8DiOjt1ayFuD2zwpE2/G3r9vRzNxZf X-Received: by 2002:a63:f954:0:b0:46f:a98a:5abf with SMTP id q20-20020a63f954000000b0046fa98a5abfmr2436551pgk.128.1668185342815; Fri, 11 Nov 2022 08:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668185342; cv=none; d=google.com; s=arc-20160816; b=i0/k5Z14KwEzsn72LxG+nnfjrBeSMPWgPIo/TOWkcBK81PHdjr7TvU/P9WWZWtGJ+o xDHzsQk0rZNMRwkuLubMsu1flyV0w3RsDJv5J/cSrRodDIlPWsunM7lk8MEeZMTV/821 0d4T1XH5kaYxejJDvBL5yBs4Jvm0zhRwr3vqbZ2nPidPDPR8c1rrpDHISreliKiH6rBC 6zFj5V02lfERnaBo7f+8BQtxuuWTV+seHjcVEu/RI/yOBANt7E8BIwP3jF7iEN5M++VA qx/amz7oTVyNvCuaqpoCNSsEybO/rZkaGXlG7eeac+yyZRZ52eI1fRFhpdNkuOFfpvfL mqwA== 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:cc:to:from:date:dkim-signature; bh=UeMTgHUqF9thG5S9v0T2ddnarlX5CPWKRPQefbjx3Dc=; b=zOsQqafz22rwugvdGdoq/FrVk9h8mJa4XiJA8p+k3YxvI1qXEq4UfCXcBG/ui3aZuN T+m/5h5TPVUJQxu9J8Yiubz5OirZruot/o2wMEMtdgHzc5ksNGfgFmMl6jcCIU1WVN6p 5DlcAdyHqpGGwS2PjO31G9GUPmt6XDjl1gLzdgP2/gI2iCt0895ZMOk0w7JJtfavuAlg pb0xmvbRykece4onokcrNoDBWhRwZuimNj1w2ZbFl5zeLyqqjKWgCkYpj/PjbZqMj41o xPLIL22m64P+abTu5H+ryYvfvmwzb78jeUFkSNjDBBGLkmsVlnnY3+AhXTsYZqAW2hnx mDOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=n7KPh4EV; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a631454000000b0044b5e15db73si2924074pgu.249.2022.11.11.08.48.33; Fri, 11 Nov 2022 08:49:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-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=n7KPh4EV; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S233911AbiKKQo7 (ORCPT + 99 others); Fri, 11 Nov 2022 11:44:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233407AbiKKQo6 (ORCPT ); Fri, 11 Nov 2022 11:44:58 -0500 X-Greylist: delayed 1241 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 11 Nov 2022 08:44:56 PST Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55166659B for ; Fri, 11 Nov 2022 08:44:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1668183833; bh=/Xl/HIo/bA+evsaq8DnE04LwbrBrmlhLVkw50rtDhtM=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=n7KPh4EVxRV/1s0qZhvnYgK/lDzUhSPnlB177nJc907rOdL7sgtSXvfbw/sNy9Jjg /oB4kM8oCzqeLEPwN+tF7XLI8HwoP88gsk+OuAJK2AAFqbCXFjTOIMY3V1J7PlezJH TVRakl92HmQu44G6RXlmsKXwLXjspuv2P2SjJOU0= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 11 Nov 2022 17:23:53 +0100 (CET) X-EA-Auth: y26A4/b47mvI+T4pBWOPntJAL2IpHjodAiXkAKUUlM2VT0sQ1jpSq3WzrIiwQtmb/c0ujW+FsdQWFt1siJbKcfQitro45GaR Date: Fri, 11 Nov 2022 21:53:46 +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 Cc: drv@mailo.com Subject: [PATCH] Bluetooth: hci_conn: Use kzalloc for kmalloc+memset Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-bluetooth@vger.kernel.org Use of kzalloc preferred over combination of kmalloc & memset. Issue identified using coccicheck. Signed-off-by: Deepak R Varma --- net/bluetooth/hci_conn.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; -- 2.34.1