Re: [patch 1/1] consolidate TRUE and FALSE

From: David Wagner
Date: Thu Mar 16 2006 - 18:51:07 EST


Randy.Dunlap wrote:
>nah, the only place that using symbolic names for true and false
>is a problem is when someone #defines or enums them bassackwards.

Here's another danger associated with #define TRUE:
int x = ...;
if (x == TRUE)
do_something();
A surprise happens if x is initialized to something other than 0 or 1.
Looks like there maybe as many as a hundred instances of the above
pattern in the kernel. Most of them seem safe, but I don't know whether
they all are, and there are too many for me to check them all.

For instance, take a look at net/core/ethtool.c:ethtool_set_rx_csum()
and drivers/net/ixgb/ixgb_ethtool.c:ixgb_set_rx_csum() and
drivers/net/ixgb/ixgb_main.c:ixgb_configure_rx() for how it handles
adapter->rx_csum to see one example that strikes me as dubious.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/