On Fri, Mar 20, 2026 at 10:42 AM Louis Chauvet
<[email protected]> wrote:
>
> On Fri, 13 Mar 2026 07:19:57 -0600, Jim Cromie <[email protected]> wrote:
> > diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> > index 0d1245aefc69..28684cfc0937 100644
> > --- a/include/linux/dynamic_debug.h
> > +++ b/include/linux/dynamic_debug.h
> > @@ -262,6 +262,8 @@ struct _ddebug_class_param {
> >
> > #define __DYNAMIC_DEBUG_CLASSMAP_USE(_var, _offset, _uname) \
> > extern struct _ddebug_class_map _var; \
> > + static_assert((_offset) >= 0 && (_offset) < _DPRINTK_CLASS_DFLT, \
> > + "classmap use offset must be in 0..62"); \
>
> Can't you also check the offset+base?
If I dont already check, I can. theyre all constants.
>
> >
> > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> > index 2083a8546460..635df6edb4cf 100644
> > --- a/lib/dynamic_debug.c
> > +++ b/lib/dynamic_debug.c
> > @@ -1404,9 +1404,8 @@ static void ddebug_apply_class_users(const struct
> > _ddebug_info *di)
> > (__dst)->info._vec.len = __nc; \
> > })
> >
> > -static int __maybe_unused
> > -ddebug_class_range_overlap(struct _ddebug_class_map *cm,
> > - u64 *reserved_ids)
> > +static int ddebug_class_range_overlap(struct _ddebug_class_map *cm,
> > + u64 *reserved_ids)
>
> I think you can remove the __maybe_unused earlier in the series (23/65
> seems to use it).
yeah that sounds correct.
>
> > @@ -1454,10 +1471,33 @@ static int ddebug_add_module(struct _ddebug_info
> > *di)
> > [ ... skip 5 lines ... ]
> > + /* validate class map types and the per-module 0..62 class_id space */
> > + for_subvec(i, cm, &dt->info, maps) {
> > + if (cm->map_type > DD_CLASS_TYPE_LEVEL_NUM) {
> > + pr_err("module %s has unknown classmap type %d\n",
> > dt->info.mod_name, cm->map_type);
> > + goto cleanup;
> > + }
>
> I think this check could be inserted earlier.
ya this could be compile-time too.
>
> --
> Louis Chauvet <[email protected]>