Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp320185pxa; Wed, 5 Aug 2020 01:54:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4VQZ1pwTcEOpu5FBPEJfPPSPiPS8+GUwvopq6kB9g5ECt3OWNQdyi9lwuWPspj5km518+ X-Received: by 2002:a17:906:364e:: with SMTP id r14mr2023113ejb.295.1596617663676; Wed, 05 Aug 2020 01:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596617663; cv=none; d=google.com; s=arc-20160816; b=X0IETYy9zgUijPeSDxTEtbJEh8auAMmVLnyd37DeDfgCaw6dWMDDV3Icyj7p8S3x61 XJ33G68VV9O4s6vrXcclDVuv9yEug517C/TmwgaWA5VLuVuuk3fVo6v6MEqHpfrOrGup WGOBTvKQA9mpsZEmBkO7vhkAKGlL5yXZxoN1HF+/C1Y7xtgDArXZ//nwk9JD/6z89qZB Ux2GYp+q1Hwzr+iHpDq1CKqDjKKF8iCV51cTy+oarFnqIYTLOtp36w7wPFgZnxx9dk9f 8yYh/mhGYnt1jtdwxlPlUV4dItGl37Z9ROZJspMIAP8cxuSqsO+55X8TZ/pBobKjjI+u asBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=sRxI/oby380zdRYIJpvmsbwtb0OYrXtkomY7r1NWGqw=; b=RNyi32t6+W2YYfGg04jRnv9ZLq7flPxVehUtAhe8wi0HlcWZmxY64IpvESzDCySSpT ymB1ZrkxSuPkkJUi/P+dvrYS4ZAu6HhrEBg8lgLliCBYT0Ne/RDcK4wRtIr39Lt37r0V AV5K/rPBTYC7B7k+g3wCs8AzLmN5TThq3YnRfGQfwu86Qrdd8Tu+KehcHtYVZSGzA5Md DoneNBCCOwgOwmh0HnVAu2Dsor1dSg4lZz57Tbq6x2t/RrYvt4X89RCtiunAY7ND/Hgy EuqQuPg808bELeuZsFlTlIC2AjXYLzrej4PdpwPY2f4GGW2v/DpCtNgMdkU3byaj2trn Z/vQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si891278edr.196.2020.08.05.01.54.01; Wed, 05 Aug 2020 01:54:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727987AbgHEIxy convert rfc822-to-8bit (ORCPT + 99 others); Wed, 5 Aug 2020 04:53:54 -0400 Received: from mx1.emlix.com ([188.40.240.192]:45754 "EHLO mx1.emlix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbgHEIxx (ORCPT ); Wed, 5 Aug 2020 04:53:53 -0400 Received: from mailer.emlix.com (unknown [81.20.119.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id DB9D65F98C; Wed, 5 Aug 2020 10:53:51 +0200 (CEST) From: Rolf Eike Beer To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Viro Cc: Ralf Baechle Subject: binfmt_elf: simplify error handling in load_elf_phdrs() Date: Wed, 05 Aug 2020 10:53:51 +0200 Message-ID: <3284126.HYjqi5uYoC@devpool35> Organization: emlix GmbH In-Reply-To: <6469675.ETGqQKjL3G@devpool35> References: <6469675.ETGqQKjL3G@devpool35> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --- fs/binfmt_elf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 251298d25c8c..64b4b47448af 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -434,7 +434,7 @@ static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex, struct file *elf_file) { struct elf_phdr *elf_phdata = NULL; - int retval, err = -1; + int retval = -1; unsigned int size; /* @@ -456,15 +456,9 @@ static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex, /* Read in the program headers */ retval = elf_read(elf_file, elf_phdata, size, elf_ex->e_phoff); - if (retval < 0) { - err = retval; - goto out; - } - /* Success! */ - err = 0; out: - if (err) { + if (retval) { kfree(elf_phdata); elf_phdata = NULL; } -- 2.28.0 -- Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source