This is a note to let you know that I've just added the patch titled

    Staging: comedi: jr3_pci: Don't ioremap too much space. Check result.

to the 2.6.32-longterm tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/longterm/longterm-queue-2.6.32.git;a=summary

The filename of the patch is:
     staging-comedi-jr3_pci-don-t-ioremap-too-much-space.-check-result.patch
and it can be found in the queue-2.6.32 subdirectory.

If you, or anyone else, feels it should not be added to the 2.6.32 longterm 
tree,
please let <[email protected]> know about it.


>From fa5c5f4ce0c9ba03a670c640cad17e14cb35678b Mon Sep 17 00:00:00 2001
From: Ian Abbott <[email protected]>
Date: Mon, 30 Nov 2009 10:59:27 +0000
Subject: Staging: comedi: jr3_pci: Don't ioremap too much space. Check result.

From: Ian Abbott <[email protected]>

commit fa5c5f4ce0c9ba03a670c640cad17e14cb35678b upstream.

For the JR3/PCI cards, the size of the PCIBAR0 region depends on the
number of channels.  Don't try and ioremap space for 4 channels if the
card has fewer channels.  Also check for ioremap failure.

Thanks to Anders Blomdell for input and Sami Hussein for testing.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/staging/comedi/drivers/jr3_pci.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -856,8 +856,11 @@ static int jr3_pci_attach(struct comedi_
        }
 
        devpriv->pci_enabled = 1;
-       devpriv->iobase =
-           ioremap(pci_resource_start(card, 0), sizeof(struct jr3_t));
+       devpriv->iobase = ioremap(pci_resource_start(card, 0),
+                       offsetof(struct jr3_t, channel[devpriv->n_channels]));
+       if (!devpriv->iobase)
+               return -ENOMEM;
+
        result = alloc_subdevices(dev, devpriv->n_channels);
        if (result < 0)
                goto out;


Patches currently in longterm-queue-2.6.32 which might be from 
[email protected] are

/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/staging-comedi-jr3_pci-don-t-ioremap-too-much-space.-check-result.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to