Nathan Chancellor wrote:
> On Wed, Oct 30, 2024 at 09:50:42AM -0500, Ira Weiny wrote:
> > [snip]
> >
> > > >> drivers/cxl/cxlmem.h:755:35: error: use of undeclared identifier
> > > >> 'regions_retunred'
> > > 755 | } __packed region[] __counted_by(regions_retunred);
> > > | ^
> > > 16 warnings and 1 error generated.
> > >
> > >
> > > vim +/regions_retunred +755 drivers/cxl/cxlmem.h
> > >
> > > 740
> > > 741 /* See CXL 3.1 Table 8-164 get dynamic capacity config Output
> > > Payload */
> > > 742 struct cxl_mbox_get_dc_config_out {
> > > 743 u8 avail_region_count;
> > > 744 u8 regions_returned;
> > > 745 u8 rsvd[6];
> > > 746 /* See CXL 3.1 Table 8-165 */
> > > 747 struct cxl_dc_region_config {
> > > 748 __le64 region_base;
> > > 749 __le64 region_decode_length;
> > > 750 __le64 region_length;
> > > 751 __le64 region_block_size;
> > > 752 __le32 region_dsmad_handle;
> > > 753 u8 flags;
> > > 754 u8 rsvd[3];
> > > > 755 } __packed region[] __counted_by(regions_retunred);
> >
> > I'm not sure why my config/compiler did not catch this typo. I'm looking
> > into it.
>
> You are likely not using a compiler that supports __counted_by, which is
> currently clang 18 (although soon to be 19.1.3 [1]) and GCC 15 (tip of
> tree), in which case, the macro just evaluates to nothing, so there is
> no validation of the value to the macro. It would be nice if there could
> be but nothing immediately comes to mind because of where this macro is
> being placed.
Yes Thanks! That was it. I did not realize counted_by was that new.[2]
Ira
[2] https://lore.kernel.org/all/[email protected]/
>
> [1]: https://lore.kernel.org/[email protected]/
>
> Cheers,
> Nathan