Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3163932pxt; Mon, 9 Aug 2021 19:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ9zklP9ClB+SG6D0VFIOlx0vMr/e4yVs0yAgpDKMuJzXu7V8vEL/BqgLfFkvpXgqTeLhE X-Received: by 2002:a17:906:831a:: with SMTP id j26mr6019811ejx.12.1628561278319; Mon, 09 Aug 2021 19:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628561278; cv=none; d=google.com; s=arc-20160816; b=xiYPHu9oDlxzHUKfPwaBK1LqPPYYbdBf1obScadHtIkOagJjopFSB8WMvTT2ykIxdZ M42nbTjQ2V4vy0nWAYR/PoRImDIpItluPiSUAkyJdTQSsMfKabEyUXgwQZIJm3qowOIw b7XfszjyYcyQmKgN40GxuNjCupBg0KiQ1LVLH4J6gdshDZyt/fRJS3kWNDtmSTGsicv4 YQYWKkXbQhq6cxyPNwtnNpRyUMkOW90wvgX10EC+bOmdJ8zSeBjkqg1irWxDouc8r9y9 a4ZZ+sf1AvtG/cbE+vxQfPpYdi2k2PWZebpzrZNPbYV0GiNMH0BDRO+KeNO6xfto5m54 m95Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=QgyrrxOHvP7M6fplZ52oJH8CjSBf+T8N9dmFTacakl0=; b=fiV8bdIYC99Z0JE2pZq4hnAfVJA6Vc1+VHrm83i0PhPZb/QX/A8S/Ct49GYVOqQLwr etJuZEfoNFsMtNnRBw7HiGfH7FnOF8VdJEWW1xwqwxaBolWI5mdhpetqdGGh/3xJg4v9 KKk5arHjX4ZmdLIVfS/XqAPUTV44VwrueszWE2hQbNfTjrAgkBNOq4zuNqk/VtqXC8+W cLxAtsq4GZ1TTCPnui60icQ6BjntVzyeVcumJl/948eOzFT0EeXOI5R23UuIWRhbEJ9x wiiASIn2TRpeBiqynCiyNn9w3KuW+D6mhOueU9KhOHhHtvrrBZBR3FW5vMzt62Y0MOKP A4FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=RJ5HVUfw; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si9047432edq.580.2021.08.09.19.07.28; Mon, 09 Aug 2021 19:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=RJ5HVUfw; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236020AbhHIVup (ORCPT + 99 others); Mon, 9 Aug 2021 17:50:45 -0400 Received: from gateway30.websitewelcome.com ([192.185.180.41]:28778 "EHLO gateway30.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232193AbhHIVuo (ORCPT ); Mon, 9 Aug 2021 17:50:44 -0400 X-Greylist: delayed 1239 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 Aug 2021 17:50:44 EDT Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id C43A7B23F for ; Mon, 9 Aug 2021 16:29:42 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id DCq6megeYK61iDCq6mfSuq; Mon, 09 Aug 2021 16:29:42 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QgyrrxOHvP7M6fplZ52oJH8CjSBf+T8N9dmFTacakl0=; b=RJ5HVUfwJimK7r90lDMzMJc0bK kSZulCYMs8kEDYXa7fYxujML3b7F4zI94vIbs1yMfALNkuQpPtZ+y4Z7L7KkyZapPQq8str0VuE1d +k13Y54uSLP/mt2btGWXP/lX9b/sPI9IxSNOm5m7SQDUHhyy4vQqu7QHJh8IohRTBTlvNHkhNN3di 9D/KDAvDLagoWUYImeYbxAvFmMcich7didzy0Sp8PEwQL0Hrg8xYkeycHQ8v/i1qyEG+UT9/u7yS5 WBVSJ4c1OC+Jhbg0+e3jXKXSsu4cz+QB3VEHdDbtKXl/IRRZMGtotuI8tKb0prXVe9bRWIBkQjjEA /ELAzuUw==; Received: from 187-162-31-110.static.axtel.net ([187.162.31.110]:36120 helo=[192.168.15.8]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1mDCq5-000CXb-UH; Mon, 09 Aug 2021 16:29:41 -0500 Subject: Re: [PATCH][next] mwifiex: usb: Replace one-element array with flexible-array member To: Brian Norris , "Gustavo A. R. Silva" Cc: Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski , linux-wireless , netdev@vger.kernel.org, Linux Kernel , linux-hardening@vger.kernel.org References: <20210809211134.GA22488@embeddedor> From: "Gustavo A. R. Silva" Message-ID: <533036d7-1a0e-21e8-5e40-2e807b32a215@embeddedor.com> Date: Mon, 9 Aug 2021 16:32:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 187.162.31.110 X-Source-L: No X-Exim-ID: 1mDCq5-000CXb-UH X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 187-162-31-110.static.axtel.net ([192.168.15.8]) [187.162.31.110]:36120 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 8/9/21 16:24, Brian Norris wrote: > On Mon, Aug 9, 2021 at 2:08 PM Gustavo A. R. Silva > wrote: >> >> There is a regular need in the kernel to provide a way to declare having >> a dynamically sized set of trailing elements in a structure. Kernel code >> should always use “flexible array members”[1] for these cases. The older >> style of one-element or zero-length arrays should no longer be used[2]. >> >> This helps with the ongoing efforts to globally enable -Warray-bounds >> and get us closer to being able to tighten the FORTIFY_SOURCE routines >> on memcpy(). >> >> This issue was found with the help of Coccinelle and audited and fixed, >> manually. >> >> [1] https://en.wikipedia.org/wiki/Flexible_array_member >> [2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays >> >> Link: https://github.com/KSPP/linux/issues/79 >> Link: https://github.com/KSPP/linux/issues/109 >> Signed-off-by: Gustavo A. R. Silva > > An important part of your patch rationale should include determining > that the 1-length wasn't actually important anywhere. I double checked > for you, and nobody seemed to be relying on 'sizeof struct fw_data' at > all, so this should be OK: I always do that. That's the reason why I included this line in the changelog text: "This issue was found with the help of Coccinelle and audited and fixed, manually." Thanks for double-checking, though. :) > Reviewed-by: Brian Norris Thanks -- Gustavo