From patchwork Fri Nov 11 07:33:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 18517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp596248wru; Thu, 10 Nov 2022 23:34:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf5QPFmeYHA4XxfpwLsvvPY1egk5S/DP+gafohm8wmxCUt99bZEn56U9i+XhCrYor/XDeIvu X-Received: by 2002:a05:6402:4018:b0:461:dd11:c1bd with SMTP id d24-20020a056402401800b00461dd11c1bdmr333001eda.406.1668152049732; Thu, 10 Nov 2022 23:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668152049; cv=none; d=google.com; s=arc-20160816; b=dpfku83WpStmdlRhY7FfdvDvNjSJ2B3oWm4uQQL+afFmBhk66SbJ76ZuLCpN1ngUsl 9pQ0bTeiAzjfgslmJzdFFDJaW8OR5mzgztB7udQaZl9+lYgi7WJAmQMmT/JuF+Pq58Bq 93D/cBY1sTYi9GC7zvQvYNejhLGearvf7SkLFIherz45ZmekoHDv01KbfCBzmIU5qn6d kSUemLqpLtbSCXS7wpIjHlbGH0vslSvQpBtS2+Y1p2vrl9RXBVMEIO3uQUXXRb+E9Lr6 hAzeLdz66MbJRwjNrWCls6b3xbzgFD6f5j8RwdNAn34sXZzRRK4a0uiwgcs9nPnsp01i GEbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=8AvYx4tOUCS8PcDh0JejMWE0HplpD7ryTVfosfPJ+S0=; b=NHcDbdhFTrvKUnaAjHAALpKQPjU/Kh1x/WLCv8BmcaLlnq++O0RZXarjaI1W3f/DN/ jnwFGFbaNtesGnBso4kXCu4HVycQwnkewUHl3uiVPGilbLiQMZ7xuCfB6m0CJXTZkcsG pddyzI52hhtT1BmCjaqIhxGsfrJ35nU6FEZN02+boy89jggqArV4V5Nyx8tVvR5eL/qg VCeMGRn191zfBOnqerG5bcDFpziOrhcn7ylEBd11k0c6E3eqv2bqzPYyvx1Cl5b1Re63 cf02/uhsBqTAKBZZavksRu6p/WR+M4DBJ5TkxbXzgmUaSTqqAhWNlE9UgVCBmH+Ea3wr CC0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="R3Poz/bD"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 21-20020a508e15000000b00461f44d7bfcsi448721edw.573.2022.11.10.23.34.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 23:34:09 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="R3Poz/bD"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C87463858298 for ; Fri, 11 Nov 2022 07:34:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C87463858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668152048; bh=8AvYx4tOUCS8PcDh0JejMWE0HplpD7ryTVfosfPJ+S0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=R3Poz/bDeGset+FP3f4eKELij7HfvsO1lU4rnTic2oajuY65sNEWopN9TMTbJUJ9T naVV9SK5wP9jE0NZpgLOYT+1ButKo0kKGQiqC9wb1lMCSxCmrDp/30k+Cbo5P6qWWl CV9ljpMm6ywIRvlVzpkV8APx8i0CsO+cnFpKtp7g= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 0FE363858C5E for ; Fri, 11 Nov 2022 07:34:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0FE363858C5E Received: by mail-pf1-x42b.google.com with SMTP id 140so2757640pfz.6 for ; Thu, 10 Nov 2022 23:34:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8AvYx4tOUCS8PcDh0JejMWE0HplpD7ryTVfosfPJ+S0=; b=lHJepbiJyyrZ8G8o2pcYFPc4h+a2jARADYVDmiHQ4+ro3uQ/puB4+rm5ro1aitbNKi ybQJ88RW6AKbHLNlWDWqzv3rcuLNMFxXRDDecPMfPWSrzRAsm1JRXOk65WssTgdAejQ9 qgfpXbCM3Ka4tagR71o//qkwkQ/ebvjMblh2k59R+nanlkPfS2cuq8ORYZFcZ5kasUH9 aawXyxdRKpjsDocje44n6CbsC71L0b9CieCwUk6roB3j76y99HtKiDw75RhwPjGR+ifK c0VimhimM0kZo9Zh3Kw2uwLamfAUiDhcQS3qzsopz6JWdelgksgK+bNAVz3odc+2cKXz lbRg== X-Gm-Message-State: ANoB5pkx7pJHDGkAZDXa65bbfTcthZDnapuCtFsdQegtMZT6yiiKcPCC 8hACXLtgkuYejUoEpSrpCquAqwgdMs0= X-Received: by 2002:a63:f91e:0:b0:464:bb6a:50de with SMTP id h30-20020a63f91e000000b00464bb6a50demr564599pgi.502.1668152038660; Thu, 10 Nov 2022 23:33:58 -0800 (PST) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b001873aa85e1fsm929922plf.305.2022.11.10.23.33.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 23:33:57 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 1E577114029A; Fri, 11 Nov 2022 18:03:55 +1030 (ACDT) Date: Fri, 11 Nov 2022 18:03:55 +1030 To: binutils@sourceware.org Subject: Sanity check SHT_MIPS_OPTIONS size Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3036.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749184203857006386?= X-GMAIL-MSGID: =?utf-8?q?1749184203857006386?= * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Use bfd_malloc_and_get_section to read contents of .MIPS.options. diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index e0e23926f03..932167c15c6 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7523,11 +7523,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, { bfd_byte *contents, *l, *lend; - contents = bfd_malloc (hdr->sh_size); - if (contents == NULL) - return false; - if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents, - 0, hdr->sh_size)) + if (!bfd_malloc_and_get_section (abfd, hdr->bfd_section, &contents)) { free (contents); return false;