mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* PATCH: trivial, nsc-ircc dongle_id fix
@ 2004-10-11 20:41 andreamrl
  0 siblings, 0 replies; only message in thread
From: andreamrl @ 2004-10-11 20:41 UTC (permalink / raw)
  To: dagb; +Cc: linux-kernel

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-11 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 20:41 PATCH: trivial, nsc-ircc dongle_id fix andreamrl

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®