From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B87CE79A5 for ; Mon, 25 Sep 2023 20:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233368AbjIYUzL (ORCPT ); Mon, 25 Sep 2023 16:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233330AbjIYUzJ (ORCPT ); Mon, 25 Sep 2023 16:55:09 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF80010F for ; Mon, 25 Sep 2023 13:54:58 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id ksbTqNdzdvU2mksbTqP3zl; Mon, 25 Sep 2023 22:54:51 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1695675291; bh=7qzOKZEryNuTAMV520/DOS4D/U+CE50T2S4n3ISZSPo=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=S9UC5lCekptgVAY6BUwXIbKLDF7xRd4t1vPiN8652emUmFC9CEym9eMfg7KM8VWst 20V41WgNpcHSCzp5WPp1Uc8fa0ziB+cnRcW0OnEpG5Hanavu1DaHor70axUQzHUR7h zCKj8EYeWktjzreF8o5yNVpPGOtMvEZpsJFZcea2pxZ3TE+S+DnTK/dNe9dgA5J2lZ c4r6vFbbHKdCiNbwp4vUjED+SIBi2NkU004OS7SVTqJ4hiAsjywiVcZ7/eWKEspCjl 4Qme0V0WvWTj/szLUXO1I44oQHB4Azg6ZFZOmWMTiPuFaxQ89kxhdDRRgux+ISUgmi YRDvdZWPb49PQ== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 25 Sep 2023 22:54:51 +0200 X-ME-IP: 86.243.2.178 Message-ID: Date: Mon, 25 Sep 2023 22:54:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH wireless 1/2] ath: dfs_pattern_detector: Fix a memory initialization issue Content-Language: fr, en-CA To: quic_jjohnson@quicinc.com Cc: christophe.jaillet@wanadoo.fr, kernel-janitors@vger.kernel.org, kvalo@kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, quic_kvalo@quicinc.com References: From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 25/09/2023 à 20:46, Jeff Johnson a écrit : > On 9/23/2023 11:57 PM, Christophe JAILLET wrote: >> If an error occurs and channel_detector_exit() is called, it relies on >> entries of the 'detectors' array to be NULL. >> Otherwise, it may access to un-initialized memory. >> >> Fix it and initialize the memory, as what was done before the commit in >> Fixes. >> >> Fixes: a063b650ce5d ("ath: dfs_pattern_detector: Avoid open coded >> arithmetic in memory allocation") >> Signed-off-by: Christophe JAILLET >> >> --- >> Patch #1/2 is a fix, for for wireless. >> Patch #2/2 is for wireless-next I guess, but depnds on #1 >> >> Not sure if we can mix different target in the same serie. Let me know. >> >> BTW, sorry for messing up things with a063b650ce5d :( >> --- >>   drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c >> b/drivers/net/wireless/ath/dfs_pattern_detector.c >> index 27f4d74a41c8..2788a1b06c17 100644 >> --- a/drivers/net/wireless/ath/dfs_pattern_detector.c >> +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c >> @@ -206,7 +206,7 @@ channel_detector_create(struct >> dfs_pattern_detector *dpd, u16 freq) >>       INIT_LIST_HEAD(&cd->head); >>       cd->freq = freq; >> -    cd->detectors = kmalloc_array(dpd->num_radar_types, >> +    cd->detectors = kcalloc(dpd->num_radar_types, >>                         sizeof(*cd->detectors), GFP_ATOMIC); > > nit: align descendant on ( Agreed, but as the code is removed in patch 2/2, I thought that having a smaller diff was a better option. Let me know if I should resend the serie. CJ > >>       if (cd->detectors == NULL) >>           goto fail; > >