From: Mikulas Patocka <mpatocka@redhat.com> To: David Miller <davem@davemloft.net> Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crash with /proc/iomem on sparc64 Date: Tue, 17 Mar 2009 08:03:24 -0400 (EDT) [thread overview] Message-ID: <Pine.LNX.4.64.0903170758060.24107@hs20-bc2-1.build.redhat.com> (raw) Hi 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. Mikulas --- arch/sparc/kernel/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c =================================================================== --- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100 +++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100 @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st 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");
WARNING: multiple messages have this Message-ID (diff)
From: Mikulas Patocka <mpatocka@redhat.com> To: David Miller <davem@davemloft.net> Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crash with /proc/iomem on sparc64 Date: Tue, 17 Mar 2009 12:03:24 +0000 [thread overview] Message-ID: <Pine.LNX.4.64.0903170758060.24107@hs20-bc2-1.build.redhat.com> (raw) Hi 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. Mikulas --- arch/sparc/kernel/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c =================================--- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100 +++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100 @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st 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");
next reply other threads:[~2009-03-17 12:03 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-03-17 12:03 Mikulas Patocka [this message] 2009-03-17 12:03 ` [PATCH] crash with /proc/iomem on sparc64 Mikulas Patocka 2009-03-17 12:08 ` Mikulas Patocka 2009-03-17 12:08 ` Mikulas Patocka 2009-03-17 13:35 ` Mikulas Patocka 2009-03-17 13:35 ` Mikulas Patocka 2009-03-17 19:15 ` David Miller 2009-03-17 19:15 ` David Miller 2009-03-19 6:53 ` David Miller 2009-03-19 6:53 ` David Miller
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Pine.LNX.4.64.0903170758060.24107@hs20-bc2-1.build.redhat.com \ --to=mpatocka@redhat.com \ --cc=davem@davemloft.net \ --cc=linux-kernel@vger.kernel.org \ --cc=sparclinux@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.