From patchwork Tue Mar 17 12:03:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 24557 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id CBA5ADDE98 for ; Tue, 17 Mar 2009 23:03:28 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756015AbZCQMD1 (ORCPT ); Tue, 17 Mar 2009 08:03:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755509AbZCQMD1 (ORCPT ); Tue, 17 Mar 2009 08:03:27 -0400 Received: from mx1.redhat.com ([66.187.233.31]:51733 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754777AbZCQMD0 (ORCPT ); Tue, 17 Mar 2009 08:03:26 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n2HC3O07019464; Tue, 17 Mar 2009 08:03:24 -0400 Received: from hs20-bc2-1.build.redhat.com (hs20-bc2-1.build.redhat.com [10.10.28.34]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2HC3Ph7015658; Tue, 17 Mar 2009 08:03:25 -0400 Received: from hs20-bc2-1.build.redhat.com (localhost.localdomain [127.0.0.1]) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1) with ESMTP id n2HC3OQs025102; Tue, 17 Mar 2009 08:03:24 -0400 Received: from localhost (mpatocka@localhost) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1/Submit) with ESMTP id n2HC3OLN025096; Tue, 17 Mar 2009 08:03:24 -0400 X-Authentication-Warning: hs20-bc2-1.build.redhat.com: mpatocka owned process doing -bs Date: Tue, 17 Mar 2009 08:03:24 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@hs20-bc2-1.build.redhat.com To: David Miller cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crash with /proc/iomem on sparc64 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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 Signed-off-by: Mikulas Patocka --- arch/sparc/kernel/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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");