Message ID | 20240904014636.2033138-1-lihongbo22@huawei.com |
---|---|
State | New |
Headers | show |
Series | [-next] mmc: sdhci-cadence: Annotate struct sdhci_cdns_phy_param with __counted_by() | expand |
[..] > - struct sdhci_cdns_phy_param phy_params[]; > + struct sdhci_cdns_phy_param phy_params[] __counted_by(count); It seems there is no such `count` member in the structure[1]. Since `counted_by` hasn't been released in GCC yet. Please, make sure to build-test any `counted_by` patches with Clang 18+. Thanks -- Gustavo [1] https://lore.kernel.org/linux-hardening/202409042358.dwEQMShp-lkp@intel.com/
On 2024/9/5 8:16, Gustavo A. R. Silva wrote: > [..] > >> - struct sdhci_cdns_phy_param phy_params[]; >> + struct sdhci_cdns_phy_param phy_params[] __counted_by(count); > > It seems there is no such `count` member in the structure[1]. > > Since `counted_by` hasn't been released in GCC yet. Please, make > sure to build-test any `counted_by` patches with Clang 18+. Sorry, it is nr_phy_params, I made a mistake with this patch. Thanks Hongbo > > Thanks > -- > Gustavo > > [1] > https://lore.kernel.org/linux-hardening/202409042358.dwEQMShp-lkp@intel.com/
diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index be1505e8c536..2690bcaeaad5 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -73,7 +73,7 @@ struct sdhci_cdns_priv { void (*priv_writel)(struct sdhci_cdns_priv *priv, u32 val, void __iomem *reg); struct reset_control *rst_hw; unsigned int nr_phy_params; - struct sdhci_cdns_phy_param phy_params[]; + struct sdhci_cdns_phy_param phy_params[] __counted_by(count); }; struct sdhci_cdns_phy_cfg {
Add the __counted_by compiler attribute to the flexible array member entries to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> --- drivers/mmc/host/sdhci-cadence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)