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 17C9FC433EF for ; Thu, 10 Feb 2022 12:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241451AbiBJMLX (ORCPT ); Thu, 10 Feb 2022 07:11:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232947AbiBJMLW (ORCPT ); Thu, 10 Feb 2022 07:11:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 802A31098; Thu, 10 Feb 2022 04:11:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34C01B82427; Thu, 10 Feb 2022 12:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA75CC004E1; Thu, 10 Feb 2022 12:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644495080; bh=m9xsRSfcgzaB9d1+P3z4hWiz8XuCiyXDg3LvpoZGVYE=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=AvHiWF2o1W2Tmfgjz0t98jT7zhVN49BIVgpu3JVEguUcZyPuh85LU+xIwZ7cDlMZD oJi+jbbPfaiTTyFndUkZ8fD5FJPV9YgLcKCFhIblT43IA8OqwPcsb6e2W9uUR367vr nVVfiQrxQhyXP/JRgNFegnDvE8OWNoiMuFpdWm0JCPg83/Na0JRNOnhg/l4JOOhWTN FkzEQwL3YBCwCmiVo+X4i4lQpZbTbNsLI7GomosobracP53NERhjMpkUuIq8cTHb1b rKIUaGcHzGBAFeDj0e4CldB0n17/TW4oYDwE6o9hwbEwuhHothcBHvKqGcFQOE4GTv Wl7NYCX3SXEeQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH V2] wcn36xx: use struct_size over open coded arithmetic From: Kalle Valo In-Reply-To: <20220208015606.1514022-1-chi.minghao@zte.com.cn> References: <20220208015606.1514022-1-chi.minghao@zte.com.cn> To: cgel.zte@gmail.com Cc: davem@davemloft.net, kuba@kernel.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Minghao Chi (CGEL ZTE)" , Zeal Robot User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <164449505175.11894.18378600637942439052.kvalo@kernel.org> Date: Thu, 10 Feb 2022 12:11:18 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cgel.zte@gmail.com wrote: > From: "Minghao Chi (CGEL ZTE)" > > Replace zero-length array with flexible-array member and make use > of the struct_size() helper in kmalloc(). For example: > > struct wcn36xx_hal_ind_msg { > struct list_head list; > size_t msg_len; > u8 msg[]; > }; > > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. > > Reported-by: Zeal Robot > Signed-off-by: Minghao Chi (CGEL ZTE) What are the changes from v1? -- https://patchwork.kernel.org/project/linux-wireless/patch/20220208015606.1514022-1-chi.minghao@zte.com.cn/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches