Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1589949rwj; Sun, 30 Oct 2022 03:20:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6B47Bo93oLlIVX4SIDu+gydTmHbZx8IOK02UKOsJMWx2u143QOrydUFvX4gXyUhIIERxcr X-Received: by 2002:a17:907:7ba4:b0:78e:281d:91ef with SMTP id ne36-20020a1709077ba400b0078e281d91efmr7586662ejc.288.1667125256198; Sun, 30 Oct 2022 03:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667125256; cv=none; d=google.com; s=arc-20160816; b=socxBMDFtx3GsRprwMk9joEK2/mgJvbXmyUDzlT+uj6lY7xhF1ajND8d4G927Xv78i 3ibK9kh6Upwb5Qj1rp9VbLU2F9MV6ud/MvxkV+tSOKgOv7EXJp8PoEXyG6dtUzt/kGRi xiKzdz8327cWFVM5nlyMATqvl1a1p4JgJfxlOtZzlEyvFJKpZicWxPtcz0Kud18itxvb hBnAsxpXo9LX68Qw2+rIq7Eg48u2rUTwSp4k/FvqcYF9zqm8QTKqVHvjJEV0hJK1VidC 8bf/JrgYh6o/zLTw6zdedmi1/xHNe3edCapV+sygJ40EwrIY1TwAtWrJO/w2C8cmqI7C ieSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=eUJxoNfXQcJ6iV4NoTH+t9QH9n6oxserIKv4zU4jPdM=; b=lY4tulR0esMoLeZb7/U7azrDi9XzTvmBYDlTHL1L8rRBVhVPJWKZDHc8aApT/jWVH7 S4r30TKA0+p0k4rUgrU4aL5hzZjs2BXpLZxKMKxj2qGOIEVC6RoBaqUgjvkoCUz0CLMO DSEEWxAZRc4sOYHH/leRj8wEC1iVwaR+GvkOCWULxY/tWYxHrRocR9FWxysinKKzg/vL ReJx1On6zQQH0xs8y3EtLAJoVe2e8Z59Lj4bQ9hTB6HDzqBsDjnI3Rnx9Re0Tqo769aX ZOh+2sVRVMGralnAEPjZdpM2FcUf/72CDXWcOeK4f2org2z+Baf5iMunXbPRFgSmf+sx 6Vdw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a69-20020a509ecb000000b0046168e49e6fsi3768983edf.80.2022.10.30.03.20.27; Sun, 30 Oct 2022 03:20:56 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbiJ3KL2 (ORCPT + 99 others); Sun, 30 Oct 2022 06:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbiJ3KL1 (ORCPT ); Sun, 30 Oct 2022 06:11:27 -0400 Received: from mx1.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80AAEC0B; Sun, 30 Oct 2022 03:11:26 -0700 (PDT) Received: from [192.168.0.2] (ip5f5ae8c4.dynamic.kabel-deutschland.de [95.90.232.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id C1CCE61EA192D; Sun, 30 Oct 2022 11:11:23 +0100 (CET) Message-ID: <80f39eff-d175-785c-c10f-a31a046ec132@molgen.mpg.de> Date: Sun, 30 Oct 2022 11:11:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v2] Bluetooth: Use kzalloc instead of kmalloc/memset To: Kang Minchul Cc: 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 References: <20221029214058.25159-1-tegongkang@gmail.com> Content-Language: en-US From: Paul Menzel In-Reply-To: <20221029214058.25159-1-tegongkang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 Dear Kang, Thank you for the patch. Am 29.10.22 um 23:40 schrieb Kang Minchul: > This commit replace kmalloc + memset to kzalloc replace*s* (Though starting with “This commit …” is redundant. > for better code readability and simplicity. > > Following messages are related cocci warnings. Maybe: This addresse the cocci warning below. > WARNING: kzalloc should be used for d, instead of kmalloc/memset > > Signed-off-by: Kang Minchul > --- > V1 -> V2: Change subject prefix > > 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; Reviewed-by: Paul Menzel Kind regards, Paul