Message ID | 20240904014636.2033138-1-lihongbo22@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next] mmc: sdhci-cadence: Annotate struct sdhci_cdns_phy_param with __counted_by() | expand |
Hi Hongbo, kernel test robot noticed the following build errors: [auto build test ERROR on next-20240903] url: https://github.com/intel-lab-lkp/linux/commits/Hongbo-Li/mmc-sdhci-cadence-Annotate-struct-sdhci_cdns_phy_param-with-__counted_by/20240904-094207 base: next-20240903 patch link: https://lore.kernel.org/r/20240904014636.2033138-1-lihongbo22%40huawei.com patch subject: [PATCH -next] mmc: sdhci-cadence: Annotate struct sdhci_cdns_phy_param with __counted_by() config: arm-randconfig-003-20240904 (https://download.01.org/0day-ci/archive/20240904/202409042358.dwEQMShp-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 05f5a91d00b02f4369f46d076411c700755ae041) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240904/202409042358.dwEQMShp-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202409042358.dwEQMShp-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/mmc/host/sdhci-cadence.c:11: In file included from include/linux/mmc/host.h:19: In file included from include/linux/blk-crypto-profile.h:9: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:8: In file included from include/linux/cacheflush.h:5: In file included from arch/arm/include/asm/cacheflush.h:10: In file included from include/linux/mm.h:2202: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ >> drivers/mmc/host/sdhci-cadence.c:76:56: error: use of undeclared identifier 'count' 76 | struct sdhci_cdns_phy_param phy_params[] __counted_by(count); | ^ 1 warning and 1 error generated. vim +/count +76 drivers/mmc/host/sdhci-cadence.c 67 68 struct sdhci_cdns_priv { 69 void __iomem *hrs_addr; 70 void __iomem *ctl_addr; /* write control */ 71 spinlock_t wrlock; /* write lock */ 72 bool enhanced_strobe; 73 void (*priv_writel)(struct sdhci_cdns_priv *priv, u32 val, void __iomem *reg); 74 struct reset_control *rst_hw; 75 unsigned int nr_phy_params; > 76 struct sdhci_cdns_phy_param phy_params[] __counted_by(count); 77 }; 78
[..] > - 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(-)