Message ID | afb365933de06282be6eb3049b0271b24536eeff.1666877952.git.szabolcs.nagy@arm.com |
---|---|
State | Committed |
Commit | d08dec4ea7c9f8b1d734cc1ba80c7f70df2f2c25 |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92B873948A63 for <patchwork@sourceware.org>; Thu, 27 Oct 2022 15:35:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92B873948A63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666884925; bh=REIKRBesRmm4ZhLIV+ZJXZo2cOj1RHi7LjPg3ta7VzI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=U5YMnifhNP++aFIca9jnLJonWsDIBTlqR0zn/+ldrXq/SSsqXkT8GrgpaX5/xywoJ Snk7p05c5x1e+9OM+zJB03wDKxPsK5RLdJI/jBjPihwyh2upwCTsstPxwBEnhYBIxd gttgVO4ZnlJVEpcC9N4OAF4gu+PM7l6S+MJ5TnxI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2047.outbound.protection.outlook.com [40.107.247.47]) by sourceware.org (Postfix) with ESMTPS id 2E8E938245B9 for <libc-alpha@sourceware.org>; Thu, 27 Oct 2022 15:33:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E8E938245B9 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=LpIMwzTXVi8GRSsx1TKJA08nJZImyog9wvGupWMe23LOZGfmZheJCeLz/L5tFIaZZxcm4Pp6AHQ3gJwXXC35q3qIy5l1zWfruIiYMuFwg6u6dMJGkRuqL9MPnfj2NiS6A7MdgsyYCTZnrHmuRBPIYoXGqoSZ83LXGn0hszZuzKK5WnL7eFhDgPB3yzowpLacZ9Ci148PHzMf0DeDPc6otl39QMxiYjwYZwJ1ACmtfuyw35cQCEwPHcKLaycbq92Oy3TBN2mxbBG1jushs2n8KPYTL4cIpp+IBQwwOVsVFmVqiwsSRPgERvpMT831ifWFrsxryp9zJvXZDcMwMx1hig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=REIKRBesRmm4ZhLIV+ZJXZo2cOj1RHi7LjPg3ta7VzI=; b=UffF6x4cCNyiUx4BjvXL2Hrew7RsepIxA0l+KRKZpolNW/SnV/ca+Kr47GyD6k+C7naosDxXqRnPWW0MxSHbU4HUz7C7ECkku++LFqIUiKI56kamJx7UGpvCDOBel+1bQxDRb+xoamvmy5WrEb3mSdIhVOM7FyF5KfUiViPEvfkZ4K/9fuMx/rjyrHUaMQZCQthE2VBeJjhxNX/rRsBZ/R0tEuK7s0DNiZs+1SJrM7/mDuoXt/z24pt6Vrg8PUjJ40bIJJUIW5DJrYjPIRrL+jDJ05SXdpu6H68I7qliKJPJIm9xB+Bzl3DI94Fa/61R/eURV/Hepef45oZNupMzbg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from AS9PR06CA0178.eurprd06.prod.outlook.com (2603:10a6:20b:45c::10) by AM8PR08MB6499.eurprd08.prod.outlook.com (2603:10a6:20b:317::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Thu, 27 Oct 2022 15:32:58 +0000 Received: from AM7EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45c:cafe::25) by AS9PR06CA0178.outlook.office365.com (2603:10a6:20b:45c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Thu, 27 Oct 2022 15:32:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT040.mail.protection.outlook.com (100.127.140.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Thu, 27 Oct 2022 15:32:57 +0000 Received: ("Tessian outbound f394866f3f2b:v130"); Thu, 27 Oct 2022 15:32:57 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 50b2fe3705918143 X-CR-MTA-TID: 64aa7808 Received: from 1e84d27238a7.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2B910CC4-7035-4917-8D73-C913E68C73CF.1; Thu, 27 Oct 2022 15:32:51 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1e84d27238a7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 27 Oct 2022 15:32:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FoBzcHEHcm+jtls/oas2tmElf7XskXtgmnt3OyaOUiiOCT46iiLvTXix369jr7BRIQO85Qiv9HaYcENAIwTlshDKN9xJHRT1XzyKJhNRjSAV0Ijo46jTbKJmOdHuC2CbCpDPmpb41Yehy+IFgRvwzXJcAk4Df/dhtf2oOOcrHF3LlXkuIa/pPzg0IWOhz1qR4UmZICQMCjqubzWHbUZx6UY7AWYB3dcCg2zarQ+Xfejxl/nieePLhFRDc+hRK7lqaYsazWoMdPDR53X3x9V6vp+HFfC2csa06s3664v8tO7nhYwbaTzNQifbJNY9acvdWiZsGKCgLb7zhLqVO+pntA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=REIKRBesRmm4ZhLIV+ZJXZo2cOj1RHi7LjPg3ta7VzI=; b=nalOIlzBmB7WDMy23k2X54zVTK9JOrhOcLg5n5pvq10fLsO8s3pNBU7ih4TRRLT+6HKOg2KWAj6IdjfsZpPhbQkjWjznKODOcQIVKuq93TwWyPVtxt4r2Jq30f+t8WvXJLj2zMwZX0fPwDc8qFifaasLORB8I/O5e47HJGyMEkSmtt9IzyptVKm9P3xYb6UQwVcdytk5G/EKSSwiiG3wvjz9EMVTqiR5hNPMlI9+HVmlJNkAQqQwuk2D6e9cPV2i08UnYZMn0aOpELuUXXOx0WJXmWDPQ7RGYFkmDbs0FDMsPJzJulitnelgsnz5LUkLJ6LkoYzYODT6dMKLgyPLRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from DU2PR04CA0235.eurprd04.prod.outlook.com (2603:10a6:10:2b1::30) by DB9PR08MB6746.eurprd08.prod.outlook.com (2603:10a6:10:2a0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Thu, 27 Oct 2022 15:32:49 +0000 Received: from DBAEUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::9e) by DU2PR04CA0235.outlook.office365.com (2603:10a6:10:2b1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23 via Frontend Transport; Thu, 27 Oct 2022 15:32:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT010.mail.protection.outlook.com (100.127.142.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5769.14 via Frontend Transport; Thu, 27 Oct 2022 15:32:49 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 27 Oct 2022 15:32:49 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Thu, 27 Oct 2022 15:32:48 +0000 To: <libc-alpha@sourceware.org> Subject: [PATCH 08/20] malloc: Use uintptr_t for pointer alignment Date: Thu, 27 Oct 2022 16:32:48 +0100 Message-ID: <afb365933de06282be6eb3049b0271b24536eeff.1666877952.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1666877952.git.szabolcs.nagy@arm.com> References: <cover.1666877952.git.szabolcs.nagy@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT010:EE_|DB9PR08MB6746:EE_|AM7EUR03FT040:EE_|AM8PR08MB6499:EE_ X-MS-Office365-Filtering-Correlation-Id: d12cec92-f1c5-4de3-1eaa-08dab8308679 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1tZ2/oLUpv0rw/5bpAG3O2CsJj1fqCiExEB6vDW8VI/awUh30E+0+7j91q8a1bV5b00Vq1usTqti/8H3Kz/COmYmC+m2yNDTSmuRf+1smjzuzIGPoBoDPP/luYfpJ43CXIXZKMdwvGuLsNkmda5WTCLvOBvL1l8zIeci5AvQmarDE/p9XmuGfjy08srEuPqdV0u0ia45UaPGx+Bxoite0Jye5Yb8YCYFm1dw3Hg5p5n75tjaAVEvJ230RwLJWAHYTLM7oIF9eto7qv0VB5BVld8v32SCaKskZmkcRTfWaPIxwFlBFHdhv1zwikBmWCMZ6XZkRE+6wIJh9Ad3lL+G4GydbnJ1iz5oKPtE11fMx4OaE6vois6RH2gEJxeLPi1ku7mYjuRtY4W33trkXNIUKaDBitd6wIJ9lChUnSHVN3lBRjVEOifbdDCNmtKuR7vYtQRyQrT4jpddVhdc6DfKkCDxHFw9D787JcBL+JluKS6YR88QfeFfOFc6/ckV68ED6JwAeblUJm4o+oBH7jDKUqEwiMXRc5C5gFMRs9dXgYfmgzRqOXNQUynVOEOGgjzDq9r56HX0GObA8GTxyiwtxrKs0L3ApK+aLUgRqvOMJaBRG8idfiJBWhkBAvrHKFemSYlA0UNo3MsmDofcoATNawTyY/NhuTJxMDPlDZwj5FMgcIdPJM4Iq4//2laOFFrG9CXDEwuIyE6UGLM8JmU/eCLhmLqN70fYEUbVukiqeowHAwfmRHorZsDEPoIz/XDLfq5U6yfZ3nNn89+iecKNLAp9SdzwqW9QFySkWn1uF7Q= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(86362001)(36756003)(81166007)(356005)(82740400003)(47076005)(336012)(186003)(40480700001)(40460700003)(478600001)(2906002)(26005)(2616005)(83380400001)(7696005)(36860700001)(426003)(44832011)(70206006)(8676002)(82310400005)(8936002)(316002)(70586007)(6916009)(4326008)(41300700001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6746 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f6496269-b62f-4d0c-7746-08dab830816e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mMMUfMjHUNHuy0xa0nuvP9pzCNtF7+/ccoNt1K8vMvfs/2n5jnzz/DWTFNqyJJcF5ZNI7bML0yPuvMBs4AOQn7IJXP06KQFKK7dpWQsO3qjYNbHxe0q3d6fiM6QwoY/TBpaipc9isrPVnJwU0WiHDjpwx4Zaq3CmAf7HmA1eQqs8qFpxLoTbCImbcQKHj6ouryNm4NJjBJ4lS4CCq7sIICI8W6bTETIzRGT8Q/FqRaByMOKsPgJ9IbGARFukI4+5ThBUudvTqoLs0xpS6CG7T3i2r2E2u4aUdtuen70AuoiUwGYgtz2daUrOt2sXeUy1uMEevCKm5w4ZuK8/mXSZgfyBQ/pU+c/1AdFC/2TkJLvZyqbakwF9rQCk76wxJxRGis9TjX54xnLYDTOEmPaMoHfLPaB1GblJEm73GKzqvQjxRytLXRIVRBSyo2llyG+BzJxkEmDE7DfdeM89PzX2zaUyqD3CVrgug4k/XQhYDdTmjFDhU6984abZSbIOJq+NP1tlzALAfUvDGf7S/3cbHTQIu07dOKX4+ix7JwoHadrRX/3W6v48plNBXoBhj8VSrTEYrVu0i5XRtjrhXsmHnB35K6eYul0kdlN52bPxilGkrK2EzgAGWgzDw/D7R6jcPdiuV3SQ3HZ+jF3gM3a0O3T+2w8wSiz/ccHENaSYf6iSoilt4mPDNk0NmPDl/YGyIv5X9iRQRsNmjVGR62AfKwiFgILtlyZ6HP9szvR9b4vPRBmDmwM/pYL2KcTmQMeBvLXpgnOdX/XUib4BxeWUNg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199015)(46966006)(36840700001)(40470700004)(81166007)(478600001)(82740400003)(8676002)(316002)(6916009)(83380400001)(336012)(70206006)(82310400005)(7696005)(36756003)(70586007)(2906002)(4326008)(44832011)(36860700001)(8936002)(5660300002)(41300700001)(40460700003)(186003)(86362001)(2616005)(47076005)(426003)(26005)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2022 15:32:57.9747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d12cec92-f1c5-4de3-1eaa-08dab8308679 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6499 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Szabolcs Nagy via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Szabolcs Nagy <szabolcs.nagy@arm.com> Cc: Carlos Eduardo Seo <carlos.seo@arm.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
patches from the morello port
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
Commit Message
Szabolcs Nagy
Oct. 27, 2022, 3:32 p.m. UTC
From: Carlos Eduardo Seo <carlos.seo@arm.com>
Avoid integer casts that assume unsigned long can represent pointers.
---
malloc/arena.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 27/10/22 12:32, Szabolcs Nagy via Libc-alpha wrote: > From: Carlos Eduardo Seo <carlos.seo@arm.com> > > Avoid integer casts that assume unsigned long can represent pointers. LGTM, thanks. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > malloc/arena.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/malloc/arena.c b/malloc/arena.c > index 074ecbc09f..f381f18371 100644 > --- a/malloc/arena.c > +++ b/malloc/arena.c > @@ -439,7 +439,7 @@ dump_heap (heap_info *heap) > fprintf (stderr, "Heap %p, size %10lx:\n", heap, (long) heap->size); > ptr = (heap->ar_ptr != (mstate) (heap + 1)) ? > (char *) (heap + 1) : (char *) (heap + 1) + sizeof (struct malloc_state); > - p = (mchunkptr) (((unsigned long) ptr + MALLOC_ALIGN_MASK) & > + p = (mchunkptr) (((uintptr_t) ptr + MALLOC_ALIGN_MASK) & > ~MALLOC_ALIGN_MASK); > for (;; ) > { > @@ -513,7 +513,7 @@ alloc_new_heap (size_t size, size_t top_pad, size_t pagesize, > p1 = (char *) MMAP (0, max_size << 1, PROT_NONE, mmap_flags); > if (p1 != MAP_FAILED) > { > - p2 = (char *) (((unsigned long) p1 + (max_size - 1)) > + p2 = (char *) (((uintptr_t) p1 + (max_size - 1)) > & ~(max_size - 1)); > ul = p2 - p1; > if (ul) > @@ -752,7 +752,7 @@ _int_new_arena (size_t size) > > /* Set up the top chunk, with proper alignment. */ > ptr = (char *) (a + 1); > - misalign = (unsigned long) chunk2mem (ptr) & MALLOC_ALIGN_MASK; > + misalign = (uintptr_t) chunk2mem (ptr) & MALLOC_ALIGN_MASK; > if (misalign > 0) > ptr += MALLOC_ALIGNMENT - misalign; > top (a) = (mchunkptr) ptr;
diff --git a/malloc/arena.c b/malloc/arena.c index 074ecbc09f..f381f18371 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -439,7 +439,7 @@ dump_heap (heap_info *heap) fprintf (stderr, "Heap %p, size %10lx:\n", heap, (long) heap->size); ptr = (heap->ar_ptr != (mstate) (heap + 1)) ? (char *) (heap + 1) : (char *) (heap + 1) + sizeof (struct malloc_state); - p = (mchunkptr) (((unsigned long) ptr + MALLOC_ALIGN_MASK) & + p = (mchunkptr) (((uintptr_t) ptr + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK); for (;; ) { @@ -513,7 +513,7 @@ alloc_new_heap (size_t size, size_t top_pad, size_t pagesize, p1 = (char *) MMAP (0, max_size << 1, PROT_NONE, mmap_flags); if (p1 != MAP_FAILED) { - p2 = (char *) (((unsigned long) p1 + (max_size - 1)) + p2 = (char *) (((uintptr_t) p1 + (max_size - 1)) & ~(max_size - 1)); ul = p2 - p1; if (ul) @@ -752,7 +752,7 @@ _int_new_arena (size_t size) /* Set up the top chunk, with proper alignment. */ ptr = (char *) (a + 1); - misalign = (unsigned long) chunk2mem (ptr) & MALLOC_ALIGN_MASK; + misalign = (uintptr_t) chunk2mem (ptr) & MALLOC_ALIGN_MASK; if (misalign > 0) ptr += MALLOC_ALIGNMENT - misalign; top (a) = (mchunkptr) ptr;