From: "andreamrl@tiscali.it" <andreamrl@tiscali.it>
To: dagb@cs.uit.no
Cc: linux-kernel@vger.kernel.org
Subject: PATCH: trivial, nsc-ircc dongle_id fix
Date: Mon, 11 Oct 2004 22:41:02 +0200 [thread overview]
Message-ID: <200410112241.02734.andreamrl@tiscali.it> (raw)
Hi!
The following patch add checks for parameter dongle_id in module nsc-ircc.
In the original version kernel opsed if passed mad dongle_id values, also
expliciting forcing dongle_id 0 was not possible.
This patch proposal trivially fix it.
altought this is against 2.6.6 kernel (sorry for that), quickly looking the
code of 2.6.8.1 seems that the bug still exist (code is mostly unchanged).
Regards,
Andrea Merello
--- nsc-ircc.c.orig 2004-10-11 16:32:16.000000000 +0200
+++ nsc-ircc.c 2004-10-11 17:13:38.000000000 +0200
@@ -72,7 +72,7 @@ static char *driver_name = "nsc-ircc";
/* Module parameters */
static int qos_mtt_bits = 0x07; /* 1 ms or more */
-static int dongle_id;
+static int dongle_id=-1;
/* Use BIOS settions by default, but user may supply module parameters */
static unsigned int io[] = { ~0, ~0, ~0, ~0 };
@@ -349,12 +349,17 @@ static int __init nsc_ircc_open(int i, c
MESSAGE("IrDA: Registered device %s\n", dev->name);
/* Check if user has supplied the dongle id or not */
- if (!dongle_id) {
+ if (dongle_id == -1) {
dongle_id = nsc_ircc_read_dongle_id(self->io.fir_base);
-
MESSAGE("%s, Found dongle: %s\n", driver_name,
dongle_types[dongle_id]);
} else {
+ if(dongle_id < 0 || dongle_id >= sizeof(dongle_types) /
sizeof(char*)){
+ MESSAGE ("%s, Invalid dongle_id: %d\n",driver_name,
+ dongle_id);
+ err=-1;
+ goto out5;
+ }
MESSAGE("%s, Using dongle: %s\n", driver_name,
dongle_types[dongle_id]);
}
@@ -367,6 +372,8 @@ static int __init nsc_ircc_open(int i, c
pmdev->data = self;
return 0;
+ out5:
+ unregister_netdev(dev);
out4:
kfree(self->tx_buff.head);
reply other threads:[~2004-10-11 20:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200410112241.02734.andreamrl@tiscali.it \
--to=andreamrl@tiscali.it \
--cc=dagb@cs.uit.no \
--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
all inboxes | Powered by JetHome®