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 9643BC3DA78 for ; Tue, 17 Jan 2023 11:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236602AbjAQLy5 (ORCPT ); Tue, 17 Jan 2023 06:54:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236927AbjAQLyf (ORCPT ); Tue, 17 Jan 2023 06:54:35 -0500 Received: from air.basealt.ru (air.basealt.ru [194.107.17.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A090635271; Tue, 17 Jan 2023 03:54:34 -0800 (PST) Received: by air.basealt.ru (Postfix, from userid 490) id 4C3352F20231; Tue, 17 Jan 2023 11:54:33 +0000 (UTC) Received: from localhost (broadband-188-32-10-232.ip.moscow.rt.ru [188.32.10.232]) by air.basealt.ru (Postfix) with ESMTPSA id 5C8D62F2022A; Tue, 17 Jan 2023 11:54:30 +0000 (UTC) Date: Tue, 17 Jan 2023 14:54:30 +0300 From: "Alexey V. Vissarionov" To: Simon Horman Cc: "Alexey V. Vissarionov" , Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alvin =?utf-8?Q?=C5=A0ipraga?= , Ahmad Fatoum , Wataru Gohda , Sebastian Andrzej Siewior , Wolfram Sang , Pieter-Paul Giesberts , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH] wifi: brcmfmac: Fix allocation size Message-ID: <20230117115430.GC15213@altlinux.org> References: <20230117104508.GB12547@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2023-01-17 12:13:06 +0100, Simon Horman wrote: >> buf_size = sizeof(*rfi); >> max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET]; >> - buf_size += (max_idx + 1) * sizeof(pkt); >> + buf_size += (max_idx + 1) * sizeof(struct sk_buff); > This is followed by: > rfi = kzalloc(buf_size, GFP_ATOMIC); > ... > rfi->pktslots = (struct sk_buff **)(rfi + 1); > The type of rfi is struct brcmf_ampdu_rx_reorder, which > looks like this: > struct brcmf_ampdu_rx_reorder > { struct sk_buff **pktslots; ... }; > And it looks to me that pkt is used as an array of > (struct sk_buff *). > So in all, it seems to me that the current code is correct. So, the buf_size is a sum of sizeof(struct brcmf_ampdu_rx_reorder) and size of array of pointers... and yes, this array is filled with pointers: rfi->pktslots[rfi->cur_idx] = pkt; Hmmm... looks correct. Sorry for bothering. -- Alexey V. Vissarionov gremlin ðòé altlinux ôþë org; +vii-cmiii-ccxxix-lxxix-xlii GPG: 0D92F19E1C0DC36E27F61A29CD17E2B43D879005 @ hkp://keys.gnupg.net