staging: dgap: Add check for MAXBOARDS in .probe (dgap_init_one)
authorMark Hounschell <markh@compro.net>
Fri, 25 Apr 2014 17:10:20 +0000 (13:10 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 May 2014 19:18:24 +0000 (12:18 -0700)
Insure we don't allow configuring more than MAXBOARDS (32).

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgap/dgap.c

index b834c83da9304a3bcc0a657a209eabb02c6f736c..f597432ede8c1fc6202bceeb70e1d25854f536c9 100644 (file)
@@ -572,6 +572,9 @@ static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        int rc;
 
+       if (dgap_NumBoards >= MAXBOARDS)
+               return -EPERM;
+
        /* wake up and enable device */
        rc = pci_enable_device(pdev);