diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-06 18:19:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:58 -0400 |
commit | a956f4ca3ede0a77e307f504e4a98554047b44ff (patch) | |
tree | 3a5c4c8256ed6e81f97aae6841f90f115de8cc26 /drivers/net | |
parent | 98b7777331d4344821e900040da5d1d3016d9e67 (diff) |
[PATCH] smsc-ircc2: drop DIM macro in favor of ARRAY_SIZE
IRDA: smsc-ircc2 - remove home-grown DIM macro, use ARRAY_SIZE intead.
Also fix out-of-bound array access.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index ab3ff0cd0431..a5090ddb0d0f 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -163,7 +163,6 @@ struct smsc_ircc_cb { | |||
163 | /* Constants */ | 163 | /* Constants */ |
164 | 164 | ||
165 | static const char *driver_name = "smsc-ircc2"; | 165 | static const char *driver_name = "smsc-ircc2"; |
166 | #define DIM(x) (sizeof(x)/(sizeof(*(x)))) | ||
167 | #define SMSC_IRCC2_C_IRDA_FALLBACK_SPEED 9600 | 166 | #define SMSC_IRCC2_C_IRDA_FALLBACK_SPEED 9600 |
168 | #define SMSC_IRCC2_C_DEFAULT_TRANSCEIVER 1 | 167 | #define SMSC_IRCC2_C_DEFAULT_TRANSCEIVER 1 |
169 | #define SMSC_IRCC2_C_NET_TIMEOUT 0 | 168 | #define SMSC_IRCC2_C_NET_TIMEOUT 0 |
@@ -240,7 +239,7 @@ static smsc_transceiver_t smsc_transceivers[] = | |||
240 | { "ATC IRMode", smsc_ircc_set_transceiver_smsc_ircc_atc, smsc_ircc_probe_transceiver_smsc_ircc_atc }, | 239 | { "ATC IRMode", smsc_ircc_set_transceiver_smsc_ircc_atc, smsc_ircc_probe_transceiver_smsc_ircc_atc }, |
241 | { NULL, NULL } | 240 | { NULL, NULL } |
242 | }; | 241 | }; |
243 | #define SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS (DIM(smsc_transceivers)-1) | 242 | #define SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS (ARRAY_SIZE(smsc_transceivers) - 1) |
244 | 243 | ||
245 | /* SMC SuperIO chipsets definitions */ | 244 | /* SMC SuperIO chipsets definitions */ |
246 | 245 | ||
@@ -400,7 +399,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u | |||
400 | goto err_out; | 399 | goto err_out; |
401 | 400 | ||
402 | err = -ENOMEM; | 401 | err = -ENOMEM; |
403 | if (dev_count > DIM(dev_self)) { | 402 | if (dev_count >= ARRAY_SIZE(dev_self)) { |
404 | IRDA_WARNING("%s(), too many devices!\n", __FUNCTION__); | 403 | IRDA_WARNING("%s(), too many devices!\n", __FUNCTION__); |
405 | goto err_out1; | 404 | goto err_out1; |
406 | } | 405 | } |