]> git.neil.brown.name Git - history.git/commitdiff
[IRDA]: Fix nsc-ircc dongle_id input
authorJean Tourrilhes <jt@bougret.hpl.hp.com>
Thu, 21 Oct 2004 15:07:40 +0000 (08:07 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Thu, 21 Oct 2004 15:07:40 +0000 (08:07 -0700)
<Original patch from Maik Broemme>

o [CRITICA] Don't Oops on invalid dongle-id in nsc-ircc driver

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/nsc-ircc.c

index c1e79f5168c9a4c21bf6b0f1458e21c6bd5bad5c..480454f657110dadf01621612de0ac1ce84cc1de 100644 (file)
@@ -351,8 +351,9 @@ static int __init nsc_ircc_open(int i, chipio_t *info)
        }
        MESSAGE("IrDA: Registered device %s\n", dev->name);
 
-       /* Check if user has supplied the dongle id or not */
-       if (!dongle_id) {
+       /* Check if user has supplied a valid dongle id or not */
+       if ((dongle_id <= 0) ||
+           (dongle_id >= (sizeof(dongle_types) / sizeof(dongle_types[0]))) ) {
                dongle_id = nsc_ircc_read_dongle_id(self->io.fir_base);
                
                MESSAGE("%s, Found dongle: %s\n", driver_name,