From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42b.google.com with SMTP id 140so2757640pfz.6 for ; Thu, 10 Nov 2022 23:34:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=8AvYx4tOUCS8PcDh0JejMWE0HplpD7ryTVfosfPJ+S0=; b=FX7CjoSpKhph2HbmMe2xFiARZ5UJ4YEOmJVW5jq9DIoQ79eKmqSyPT1hSVXC3QYznf ZOvWtVg3uNoZWuQi19D4tqx43FLeRum/psACv0qZ49UB3HP7VbfBOHiwrcIxhWv+Lgt2 LqGrKJCFnJW54XLB7//Nggx2Ixg/EQhsQ6ROMHKp1bKTd5JYWUDTz59YZX6F8ifJxDZo Jcs1a8KUjcuOsKQhoDt2arGaHPvMl51i815e5NJeRuWIEZ/9OmpeImSvKy+nC+Iu+v+/ 1ZgFq/hZ75iw7Q3KxBp8BLdIoXPjuufhpm5bPNtK4b6nsfPUoY84BFVDTYUjuSDHKJbJ S8sQ== 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-Google-Smtp-Source: AA0mqf4rmgtakF3sXTalGirEP7d6b/yYCtTfPe94pxc1U3I+xNaZg96y//bFd4Lqe/yAtp7Thbg4Zw== 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 From: Alan Modra To: binutils@sourceware.org Subject: Sanity check SHT_MIPS_OPTIONS size Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 List-Id: * 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; -- Alan Modra Australia Development Lab, IBM