Page MenuHomeFreeBSD

iflib: mark irq allocation name parameter as constant
ClosedPublic

Authored by jacob.e.keller_intel.com on May 7 2018, 11:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 24, 4:03 PM
Unknown Object (File)
Mon, Sep 23, 11:47 PM
Unknown Object (File)
Thu, Sep 19, 12:46 PM
Unknown Object (File)
Thu, Sep 19, 12:46 PM
Unknown Object (File)
Thu, Sep 19, 12:45 PM
Unknown Object (File)
Thu, Sep 19, 12:45 PM
Unknown Object (File)
Thu, Sep 19, 12:38 PM
Unknown Object (File)
Sep 11 2024, 10:46 PM
Subscribers

Details

Summary

The *name parameter passed to iflib_irq_alloc_generic and
iflib_softirq_alloc_generic is never modified. Many places in code pass
string literals and thus should not be modified.

Mark the *name parameter as a const char * instead, so that we enforce
that the name is not modified before passing to bus_describe_intr()

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16534
Build 16448: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.May 8 2018, 2:24 AM
shurd requested changes to this revision.May 8 2018, 5:24 PM

Are there some bits missing from the review?


/usr/home/shurd/src/fbsd/sys/net/iflib.c:5308:92: error: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
err = iflib_irq_set_affinity(ctx, rman_get_start(irq->ii_res), type, qid, gtask, tqg, q, name);
^~~~
/usr/home/shurd/src/fbsd/sys/net/iflib.c:5215:72: note: passing argument to parameter 'name' here
struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name)
^
/usr/home/shurd/src/fbsd/sys/net/iflib.c:5356:72: error: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
err = iflib_irq_set_affinity(ctx, irq_num, type, qid, gtask, tqg, q, name);
^~~~
/usr/home/shurd/src/fbsd/sys/net/iflib.c:5215:72: note: passing argument to parameter 'name' here
struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name)
^
/usr/home/shurd/src/fbsd/sys/net/iflib.c:5376:1: error: conflicting types for 'iflib_legacy_setup'
iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *rid, const char *name)
^
/usr/home/shurd/src/fbsd/sys/net/iflib.c:723:12: note: previous declaration is here
static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, char *str);
^

This revision now requires changes to proceed.May 8 2018, 5:24 PM

Hmmm... I think there were. I'll double check this later today and see what I missed. I have a separate system for sending the reviews because my test system doesn't have direct access, I probably just forgot a few lines..

Looks like this involves a bit more cleanup to the taskqgroup code (since ultimately the name gets passed there). due to the scope I think I'll split it into two commits.

  • taskqgroup: make tqg_name a constant
  • taskqgroup: mark name paramter of taskqgroup_attach as const
  • iflib: mark irq allocation name parameter as constant
This revision is now accepted and ready to land.May 29 2018, 9:52 PM
This revision was automatically updated to reflect the committed changes.