From: Dmitry Torokhov <dtor_core@ameritech.net>
To: irda-users@lists.sourceforge.net
Cc: Jean Tourrilhes <jt@hpl.hp.com>, linux-kernel@vger.kernel.org
Subject: [patch 3/9] smsc-ircc2: drop DIM macro in favor of ARRAY_SIZE
Date: Wed, 25 May 2005 01:37:41 -0500 [thread overview]
Message-ID: <20050525064005.843762000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20050525063738.864916000.dtor_core@ameritech.net
[-- Attachment #1: ircc2-remove-dim.patch --]
[-- Type: text/plain, Size: 1365 bytes --]
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>
---
smsc-ircc2.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
Index: dtor/drivers/net/irda/smsc-ircc2.c
===================================================================
--- dtor.orig/drivers/net/irda/smsc-ircc2.c
+++ dtor/drivers/net/irda/smsc-ircc2.c
@@ -163,7 +163,6 @@ struct smsc_ircc_cb {
/* Constants */
static const char *driver_name = "smsc-ircc2";
-#define DIM(x) (sizeof(x)/(sizeof(*(x))))
#define SMSC_IRCC2_C_IRDA_FALLBACK_SPEED 9600
#define SMSC_IRCC2_C_DEFAULT_TRANSCEIVER 1
#define SMSC_IRCC2_C_NET_TIMEOUT 0
@@ -240,7 +239,7 @@ static smsc_transceiver_t smsc_transceiv
{ "ATC IRMode", smsc_ircc_set_transceiver_smsc_ircc_atc, smsc_ircc_probe_transceiver_smsc_ircc_atc },
{ NULL, NULL }
};
-#define SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS (DIM(smsc_transceivers)-1)
+#define SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS (ARRAY_SIZE(smsc_transceivers) - 1)
/* SMC SuperIO chipsets definitions */
@@ -400,7 +399,7 @@ static int __init smsc_ircc_open(unsigne
goto err_out;
err = -ENOMEM;
- if (dev_count > DIM(dev_self)) {
+ if (dev_count >= ARRAY_SIZE(dev_self)) {
IRDA_WARNING("%s(), too many devices!\n", __FUNCTION__);
goto err_out1;
}
next prev parent reply other threads:[~2005-05-25 7:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-25 6:37 [patch 0/9] smsc-ircc2: sysfs, suspend and other patches Dmitry Torokhov
2005-05-25 6:37 ` [patch 1/9] smsc-ircc2: whitespace fixes Dmitry Torokhov
2005-05-25 6:37 ` [patch 2/9] smsc-ircc2: formatting fixes Dmitry Torokhov
2005-05-25 6:37 ` Dmitry Torokhov [this message]
2005-05-25 6:37 ` [patch 4/9] smsc-ircc2: remove typedefs Dmitry Torokhov
2005-05-25 6:37 ` [patch 5/9] smsc-ircc2: dont pass iobase around Dmitry Torokhov
2005-05-25 6:37 ` [patch 6/9] smsc-ircc2: add to sysfs as platform device, new PM Dmitry Torokhov
2005-05-25 6:37 ` [patch 7/9] smsc-ircc2: PM cleanup - do not close device when suspending Dmitry Torokhov
2005-05-25 6:37 ` [patch 8/9] smsc-ircc2: use netdev_priv() Dmitry Torokhov
2005-05-25 6:37 ` [patch 9/9] smsc-ircc2: dont use void * where specific type will do Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050525064005.843762000.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=irda-users@lists.sourceforge.net \
--cc=jt@hpl.hp.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox