From: Stephan von Krawczynski <skraw@ithnet.com>
To: linux-kernel@vger.kernel.org
Cc: kkeil@suse.de, kai.germaschewski@gmx.de,
marcelo@conectiva.com.br, torvalds@transmeta.com
Subject: [PATCH] for pre6: hisax user config MAX_CARD and fix potential data trashing
Date: Sat, 8 Dec 2001 01:01:57 +0100 [thread overview]
Message-ID: <20011208010157.1b6ff664.skraw@ithnet.com> (raw)
In-Reply-To: <20011204174836.0ab6f5de.skraw@ithnet.com>
In-Reply-To: <20011204174836.0ab6f5de.skraw@ithnet.com>
Hello Karsten,
Hello Kai,
attached is the second patch for ISDN-Driver HiSax for kernel-inclusion that does the
following:
1) Make HISAX_MAX_CARDS user configurable during make menuconfig
2) Fix a potential trashing of data for the auto-add of SCITEL QUAD card. It did not check at all, if there was enough room to include further cards!
Patch is diffed to 2.4.17-pre6 (yes I am fast :-) and compiles ok.
As it is a bit bigger than originaly intended, can you please comment on it, Kai.
I had to fix the init part, because you can now configure the MAX_CARDS-value _down_ to 1.
Thanks to Keith Owens for Makefile fiddling.
Regards,
Stephan
hisax-max-patch-2:
--- linux/drivers/isdn/Config.in-orig Sat Dec 8 00:35:27 2001
+++ linux/drivers/isdn/Config.in Sat Dec 8 00:35:15 2001
@@ -42,6 +42,7 @@
fi
bool ' HiSax Support for german 1TR6' CONFIG_HISAX_1TR6
bool ' HiSax Support for US NI1' CONFIG_HISAX_NI1
+ int ' Maximum number of cards supported by HiSax' CONFIG_HISAX_MAX_CARDS 8
comment ' HiSax supported cards'
bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0
bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
--- linux/drivers/isdn/hisax/Makefile-orig Sat Dec 8 00:24:43 2001
+++ linux/drivers/isdn/hisax/Makefile Sat Dec 8 00:25:39 2001
@@ -4,6 +4,10 @@
O_TARGET := vmlinux-obj.o
+# Define maximum number of cards
+
+EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
+
# Objects that export symbols.
export-objs := config.o fsm.o hisax_isac.o
--- linux/drivers/isdn/hisax/hisax.h-orig Sat Dec 8 00:24:20 2001
+++ linux/drivers/isdn/hisax/hisax.h Sat Dec 8 00:40:49 2001
@@ -950,7 +950,9 @@
#define MON0_TX 4
#define MON1_TX 8
+#ifndef HISAX_MAX_CARDS
#define HISAX_MAX_CARDS 8
+#endif
#define ISDN_CTYPE_16_0 1
#define ISDN_CTYPE_8_0 2
--- linux/drivers/isdn/hisax/config.c-orig Sat Dec 8 00:24:26 2001
+++ linux/drivers/isdn/hisax/config.c Sat Dec 8 00:33:57 2001
@@ -336,17 +336,8 @@
NULL, \
}
-#define EMPTY_CARD {0, DEFAULT_PROTO, {0, 0, 0, 0}, NULL}
-
struct IsdnCard cards[HISAX_MAX_CARDS] = {
FIRST_CARD,
- EMPTY_CARD,
- EMPTY_CARD,
- EMPTY_CARD,
- EMPTY_CARD,
- EMPTY_CARD,
- EMPTY_CARD,
- EMPTY_CARD,
};
#define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
@@ -454,6 +445,7 @@
i = 0;
j = 1;
while (argc && (i < HISAX_MAX_CARDS)) {
+ cards[i].protocol = DEFAULT_PROTO;
if (argc) {
cards[i].typ = ints[j];
j++;
@@ -1405,6 +1397,8 @@
cards[j].protocol = protocol[i];
nzproto++;
}
+ else
+ cards[j].protocol = DEFAULT_PROTO;
switch (type[i]) {
case ISDN_CTYPE_16_0:
cards[j].para[0] = irq[i];
@@ -1481,15 +1475,22 @@
} else {
/* QUADRO is a 4 BRI card */
cards[j++].para[0] = 1;
- cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
- cards[j].protocol = protocol[i];
- cards[j++].para[0] = 2;
- cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
- cards[j].protocol = protocol[i];
- cards[j++].para[0] = 3;
- cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
- cards[j].protocol = protocol[i];
- cards[j].para[0] = 4;
+ /* we need to check if further cards can be added */
+ if (j < HISAX_MAX_CARDS) {
+ cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
+ cards[j].protocol = protocol[i];
+ cards[j++].para[0] = 2;
+ }
+ if (j < HISAX_MAX_CARDS) {
+ cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
+ cards[j].protocol = protocol[i];
+ cards[j++].para[0] = 3;
+ }
+ if (j < HISAX_MAX_CARDS) {
+ cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
+ cards[j].protocol = protocol[i];
+ cards[j].para[0] = 4;
+ }
}
break;
}
@@ -1563,6 +1564,8 @@
if (protocol[i]) {
cards[i].protocol = protocol[i];
}
+ else
+ cards[i].protocol = DEFAULT_PROTO;
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int) pcm_iob;
@@ -1603,6 +1606,8 @@
if (protocol[i]) {
cards[i].protocol = protocol[i];
}
+ else
+ cards[i].protocol = DEFAULT_PROTO;
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int) pcm_iob;
@@ -1643,6 +1648,8 @@
if (protocol[i]) {
cards[i].protocol = protocol[i];
}
+ else
+ cards[i].protocol = DEFAULT_PROTO;
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int) pcm_iob;
@@ -1683,6 +1690,8 @@
if (protocol[i]) {
cards[i].protocol = protocol[i];
}
+ else
+ cards[i].protocol = DEFAULT_PROTO;
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int) pcm_iob;
next prev parent reply other threads:[~2001-12-08 0:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-04 16:48 [PATCH] hisax fix MAX_CARD setup and potential buffer overflow Stephan von Krawczynski
2001-12-08 0:01 ` Stephan von Krawczynski [this message]
2001-12-08 9:39 ` [PATCH] for pre6: hisax user config MAX_CARD and fix potential data trashing Kai Germaschewski
2001-12-08 15:12 ` Stephan von Krawczynski
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=20011208010157.1b6ff664.skraw@ithnet.com \
--to=skraw@ithnet.com \
--cc=kai.germaschewski@gmx.de \
--cc=kkeil@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=torvalds@transmeta.com \
/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