From patchwork Tue Sep 8 13:49:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 515403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DA67A1401AF for ; Tue, 8 Sep 2015 23:50:07 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=prksfPkh; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=ZXQqQaD8XV21Au8bGv8aSxMG8qpVex4yzF6wGf5bvqWQE+ av9udQwszYPNrE1hFLuN18jam0kaXtVOztSXD++C/7gexab2yN5zA8Nt6MxXUAEM +/d+E13JmCWFhDC7c+rDkqso8NroGtbpcsCCS3S/Hci+Zf8dC0hJFMbL0i+NQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=jvmIPJVeUed1twiReAEtYeH7Vi8=; b=prksfPkhmmvXRMtHKKwi rS6eFXf3L8M3LJ4brl9XFEtXzlJLeM4+PHMUaQTWOsboogWtXivLn+8Wij64RdfG QwhpVdlelagKY834MWJT1LyifuzLVBLDagzpWIVS3JBUc5kPlwZm2dkQSApVb4JE bnxNvO/tmkoQ2BqtWOsYxLU= Received: (qmail 37321 invoked by alias); 8 Sep 2015 13:49:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 37212 invoked by uid 89); 8 Sep 2015 13:49:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ob0-f181.google.com Received: from mail-ob0-f181.google.com (HELO mail-ob0-f181.google.com) (209.85.214.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 08 Sep 2015 13:49:29 +0000 Received: by obbda8 with SMTP id da8so55130840obb.1 for ; Tue, 08 Sep 2015 06:49:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=j4YeIxp09ZObbW5Lfaplh2gHwt+JXeBFg46sJLp7L50=; b=ZXHvUwjfnK4XkqGre0OlLmi/N+8tAFfz4hBdBy/u8b7HLG98uOXoIqs8lJIHrs0XSm RgG0PaKQ+n5eBTlu2bQ3W/tyw5bSWcc1SAZ38Icrf5mKryIO5NVjDfkalKu6yQF6goWx Yud/AMGE9bY8SE4rYtWuXtU7qQau4w/frPypu9J+/VDka3vh8BSaQ84Iik8I5Gy+sCqP DwxtJzXDp/AKb8mDmQQZeBQjd6O/JD5aR8hfLkplq87gGxv5r2RmCOQ49CbfKNu785Dk jZhZU8PRaWc0MeZEAHmsZT9yL57/w5hwnJRzqTR6xGTtXegZCSFqvmxE7i9OSUUBAp4/ kxvQ== X-Gm-Message-State: ALoCoQnYNLAWbmQLESjQ2QjGmPZmqHOvtlFEUeAaZlrdlp8LH4Hsaq5aXdqfzlGRg/PUXERqjPNp MIME-Version: 1.0 X-Received: by 10.60.92.199 with SMTP id co7mr20235385oeb.37.1441720166818; Tue, 08 Sep 2015 06:49:26 -0700 (PDT) Received: by 10.60.160.67 with HTTP; Tue, 8 Sep 2015 06:49:26 -0700 (PDT) Date: Tue, 8 Sep 2015 06:49:26 -0700 Message-ID: Subject: libbacktrace patch committed: fix test for mmap failure From: Ian Lance Taylor To: gcc-patches X-IsSubscribed: yes PR 67457 points out a crash in libbacktrace when there is no memory available. This is because the code testing the mmap result for failure is broken. This patch fixes it. Bootstrapped and ran libbacktrace tests. Committed to mainline. Ian 2015-09-08 Ian Lance Taylor PR other/67457 * mmap.c (backtrace_alloc): Correct test for mmap failure. Index: mmap.c =================================================================== --- mmap.c (revision 227528) +++ mmap.c (working copy) @@ -139,7 +139,7 @@ backtrace_alloc (struct backtrace_state asksize = (size + pagesize - 1) & ~ (pagesize - 1); page = mmap (NULL, asksize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (page == NULL) + if (page == MAP_FAILED) error_callback (data, "mmap", errno); else {