Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5300886rwb; Wed, 7 Sep 2022 00:03:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5rByvg62tQmmkhnfGJ3lCtaTeClzRR9pmfRGlS6QRJniPH4tEsCM7KwmXoowB+jK8CVVzX X-Received: by 2002:a17:90b:4c11:b0:1fb:66d3:79f with SMTP id na17-20020a17090b4c1100b001fb66d3079fmr2528613pjb.44.1662534210238; Wed, 07 Sep 2022 00:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662534210; cv=none; d=google.com; s=arc-20160816; b=f51yxxeqfNgBh2VwaXMEtlCYzMVSoeG+0RVc9dwfGmJu9WVNNFSVwx65/m4+3pXvvW Juk3AJTpG6y1vsTELDSj1009Tvz18baGdFNTsjCNMtIMdREgTWcakRxD9zD3TfX/gFSS u2Lzkl8wDAJ8KFW53xA8wBF6JeLWmNki8t2UQVdTcukJAFdwMKsy9Cyq4/yvKB94VrSI QsjJ2O/dvnLnEj+vND8qUsbsL9A+gOY+JMB9itTIULEVI958Xy5+DYvFo0PhHhLfhjbL huhWBw+skcIUbKKFvZoKSpLuGgSjCCRzN2qLEH5fa5Qxqdl6N2dtnXM4AQak5hwr1s85 7Ajw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=7aRf3LmAuOgsa0K3mZL4MWjWCbtZAFjGn1fJm/Bawa8=; b=zVtmOu/mb8pKEd8UbPzY/BMYImQi+h5MQYJxjMHLzxQwQZPckWVfPQkk/kG6F3Qll4 Ih9fKF+vO1AN6B0vma9zF+RIGyCmXw4Mm3B2Hro8J7v9enX1ODpZlrYgd27XmXz4ZpzE jvxIW3tOaXCln9tT00/4lsNWhl2xPnZtwA7fx6uV4LSdH5hnCfZ7NZfCpjx8aPWZyqVq zqWYlRGWveHMJ4xdufbI13kdSsq+KN/zE5gbj8nN7FgjUhROCeQRPpsdM21sEzM5TjNc QIkm4/ng417YUKx56/0ID4/qrswF4QiR40yNYAOufu1VYOqNqB5Gd6UNSKRY8rMs0Zu2 Jt1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=fegTHe8u; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a056a0008d600b0053a9a08b0c8si14200435pfu.251.2022.09.07.00.03.14; Wed, 07 Sep 2022 00:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=fegTHe8u; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229516AbiIGG5d (ORCPT + 64 others); Wed, 7 Sep 2022 02:57:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbiIGG5d (ORCPT ); Wed, 7 Sep 2022 02:57:33 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B93BA883EB for ; Tue, 6 Sep 2022 23:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=7aRf3LmAuOgsa0K3mZL4MWjWCbtZAFjGn1fJm/Bawa8=; t=1662533851; x=1663743451; b=fegTHe8u6t1gTPC6YH7hjfAB5mYdtHx9L2fAL+w8Sm18B3t /H/496CxMIygkg/G3gRXjD50kIlH3oIdKc85eu/IYcOEyqXtczomEY2TuvI+UkDATovAKrDZvmbYX gAFKmBdgiu8J9Z7SaMWgmukEG323vaR79ZZOT5+IvxyBmZlft5VXH9nukhPJ3c9zNSx4d5Tq3zX4K /L9kaL4vI4a7iIjpdxfas5ntkq8uj8xJ/Lnx1OdqQAzH3I4suXyfIUqiyB6gZ/Hq2wkfLu6kWtPrQ NPjBnBgMtSfMAzOkX3ORGXpDZd6uEjNsqoVXsXNF8/wFD7KfIbMLvYyKIIaygEJQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1oVp05-00AEVR-1h; Wed, 07 Sep 2022 08:57:29 +0200 Message-ID: Subject: Re: [PATCH 07/12] wifi: mwifiex: fix array of flexible structures warnings From: Johannes Berg To: Brian Norris Cc: linux-wireless@vger.kernel.org Date: Wed, 07 Sep 2022 08:57:28 +0200 In-Reply-To: References: <20220904212910.8169e8c9090c.I0357e80cc86be2d4ac6205d1f53568444dcf7c9b@changeid> <20220904212910.2c885310ebee.If7177ea588b56c405eee6e6df595e9efccdfb99a@changeid> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-wireless@vger.kernel.org On Tue, 2022-09-06 at 15:20 -0700, Brian Norris wrote: > Hi, >=20 > On Sun, Sep 04, 2022 at 09:29:07PM +0200, Johannes Berg wrote: > > From: Johannes Berg > >=20 > > There are two, just change them to have a "u8 data[]" type > > member, and add casts where needed. No binary changes. >=20 > Hmm, what exact warning are you looking at? This one? > https://clang.llvm.org/docs/DiagnosticsReference.html#wflexible-array-ext= ensions >=20 I think gcc also has one with W=3D1 now? But yes, it's similar to that one. I was looking at Jakub's netdev test builds here: https://patchwork.hopto.org/static/nipa/673828/12964988/build_32bit/stderr ../drivers/net/wireless/marvell/mwifiex/fw.h:2107:46: warning: array of fle= xible structures ../drivers/net/wireless/marvell/mwifiex/fw.h:2257:47: warning: array of fle= xible structures > > @@ -2104,7 +2104,7 @@ struct mwifiex_fw_mef_entry { > > struct host_cmd_ds_mef_cfg { > > __le32 criteria; > > __le16 num_entries; > > - struct mwifiex_fw_mef_entry mef_entry[]; > > + u8 mef_entry_data[]; >=20 > Do you actually need this part of the change? The 'mef_entry' (or > 'mef_entry_data') field is not actually used anywhere now, but I can't > tell what kind of warning is involved. But it itself is variable, so the compiler is (rightfully, IMHO) saying that you can't have an array of something that has a variable size, even if it's a variable array. > > struct host_cmd_ds_coalesce_cfg { > > __le16 action; > > __le16 num_of_rules; > > - struct coalesce_receive_filt_rule rule[]; > > + u8 rule_data[]; >=20 > These kinds of changes seem to be losing some valuable information. At a > minimum, it would be nice to leave a comment that points at the intended > struct; but ideally, we'd be able to still get the type safety from > actually using the struct, instead of relying on casts and/or u8/void. All fair points. This was the way we typically do this in e.g. ieee80211.h ("u8 variable[]", not "struct element elems[]"), but YMMV. I thought later after Kalle asked about making it a single entry such as struct coalesce_receive_filt_rule first_rule; but then the sizeof() is messed up and then the change has to be much more careful. Anyway, I was mostly trying to remove some warnings in drivers that don't really have a very active maintainer anymore, since we have so many in wireless it sometimes makes it hard to see which ones are new. No particular feelings about this patch :-) johannes