tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: Signed vs unsigned comparisons in sys/dev/pcio/if_wm.c



On Sun, 13 Nov 2016, matthew green wrote:

While starting to investigate the possibility of modularizing the
if_wm(4) driver, I discovered some issues where signed expressions are
being compared to unsigned expressions.  When if_wm.c is being compiled
as a built-in driver, these errors are ignored.  However, when build as
a loadable module, they are fatal to the build!

There are three instances within if_wm.c where this occurs, at source
lines 6164, 6688, and 9204 (based on revision 1.443).  The attached
diffs make the compiler happy in both cases (kernel and module).

Is there any reason why these changes should not be committed?

adding "(int)" casts to appease sign compare warnings considered
not worth the churn or ugliness or casts.

we shouldn't use a special warning for module builds, and while i
tend to agree with using more warning messages than fewer, i'm not
convinced this one is worth the casts and beyond churn required.

Yeah, no worry.

Turns out that there are a couple of rather complicated dependencies that would need to be modularized before if_wm. Particularly, the mii stuff (complicated in that it would ideally require an ability to auto-load modules for whichever phy(s) are found), and if_ethersubr (which is complicated due to #ifdef/#endif maze).

I'm not going to move forward on any of this in the near future...



+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+


Home | Main Index | Thread Index | Old Index