summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-03-18 23:53:16 -0700
committerDavid S. Miller <davem@davemloft.net>2009-03-18 23:53:16 -0700
commit192d7a4667c6d11d1a174ec4cad9a3c5d5f9043c (patch)
tree492fa7fbedffb167191aa4d6e218613667fb2864 /arch
parent42cc77c861e8e850e86252bb5b1e12e006261973 (diff)
downloadlwn-192d7a4667c6d11d1a174ec4cad9a3c5d5f9043c.tar.gz
lwn-192d7a4667c6d11d1a174ec4cad9a3c5d5f9043c.zip
sparc64: Fix crash with /proc/iomem
When you compile kernel on Sparc64 with heap memory checking and type "cat /proc/iomem", you get a crash, because pointers in struct resource are uninitialized. Most code fills struct resource with zeros, so I assume that it is responsibility of the caller of request_resource to initialized it, not the responsibility of request_resource functuion. After 2.6.29 is out, there could be a check for uninitialized fields added to request_resource to avoid crashes like this. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/pci_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index 64e6edf17b9d..b775658a927d 100644
--- a/arch/sparc/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
@@ -368,7 +368,7 @@ static void pci_register_iommu_region(struct pci_pbm_info *pbm)
const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
if (vdma) {
- struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
+ struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
if (!rp) {
prom_printf("Cannot allocate IOMMU resource.\n");