WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] pciback: Avoid large array allocation

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] pciback: Avoid large array allocation on kernel stack.
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 08 Sep 2008 08:40:09 -0700
Delivery-date: Mon, 08 Sep 2008 08:39:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1220706882 -3600
# Node ID 67ff2b5a88ec1873ef0ed698dc701640fbbbfd6f
# Parent  ad374a7a9f3ed6417ffa9ba9590e056d67081985
pciback: Avoid large array allocation on kernel stack.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 drivers/xen/pciback/conf_space_capability_msi.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff -r ad374a7a9f3e -r 67ff2b5a88ec 
drivers/xen/pciback/conf_space_capability_msi.c
--- a/drivers/xen/pciback/conf_space_capability_msi.c   Fri Sep 05 12:39:29 
2008 +0100
+++ b/drivers/xen/pciback/conf_space_capability_msi.c   Sat Sep 06 14:14:42 
2008 +0100
@@ -2,6 +2,7 @@
  * PCI Backend -- Configuration overlay for MSI capability
  */
 #include <linux/pci.h>
+#include <linux/slab.h>
 #include "conf_space.h"
 #include "conf_space_capability.h"
 #include <xen/interface/io/pciif.h>
@@ -37,12 +38,15 @@ int pciback_enable_msix(struct pciback_d
 int pciback_enable_msix(struct pciback_device *pdev,
                struct pci_dev *dev, struct xen_pci_op *op)
 {
-       int i;
-       int result;
-       struct msix_entry entries[op->value];
+       int i, result;
+       struct msix_entry *entries;
 
        if (op->value > SH_INFO_MAX_VEC)
                return -EINVAL;
+
+       entries = kmalloc(op->value * sizeof(*entries));
+       if (entries == NULL)
+               return -ENOMEM;
 
        for (i = 0; i < op->value; i++) {
                entries[i].entry = op->msix_entries[i].entry;
@@ -55,6 +59,8 @@ int pciback_enable_msix(struct pciback_d
                op->msix_entries[i].entry = entries[i].entry;
                op->msix_entries[i].vector = entries[i].vector;
        }
+
+       kfree(entries);
 
        op->value = result;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] pciback: Avoid large array allocation on kernel stack., Xen patchbot-linux-2.6.18-xen <=