Skip to content

Commit

Permalink
sparc64: Fix crash with /proc/iomem
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mikulas Patocka authored and David S. Miller committed Mar 19, 2009
1 parent 42cc77c commit 192d7a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sparc/kernel/pci_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 192d7a4

Please sign in to comment.