From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3327EC433FE for ; Wed, 24 Nov 2021 12:22:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 899E682F7D; Wed, 24 Nov 2021 13:22:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1637756554; bh=WNZhRv0VNRgTxlBWgfB6Ox8qM00Q2RiMXVgFNrtsTnc=; h=To:cc:From:Subject:In-reply-to:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fHAmpNalzH2ytu+rbEjL2LyBWMKgtSzxJu6L2kmYYzEhU5nIxkirZHytt5R9rB6NK dkoNdQIGijrcrkpTFSwzFVLR+FoQDvaDo+y/LOyhuUuZJ0Hnk8wiqYWq9tDTU1S3sb 0YDAJnoZOSur03mQvFhaZcXWaOuB+LBKvPHCJcZSJsKc4DOy1tdhJ9jryNO0tyh0sx TXERTxkoO3FY3tRWF6CsFtcP469lRLvyDmD38U8LfX55ZJbFs3F6XroAGVY/u7LVgJ na+ww8tRGCktQK5+jeGl32B6Wylv3x7aFTVMNlvK9M7bjfZi0p+OEf8dkh50SOa0pO sdVksiwpPr4Vg== Received: from janitor.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 5660C82F78 for ; Wed, 24 Nov 2021 13:22:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1637756552; bh=WNZhRv0VNRgTxlBWgfB6Ox8qM00Q2RiMXVgFNrtsTnc=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=Dz+Z8DbWc0J5VcF/9pvY5LHcb91CucqSg/BmCdFK14m4UvhcgXWMU1tvlKI+gZnky gOcPIGlXaWlub1EVaoWofTTEauutWJDlpLQpykPC98fli6s32VsKwB2DvEQnv6FkNZ UIwMeYMLo2cqPhCEK3CDW9k+SB4xe0JL1UuSN3fn5x9p5rGtKAdj6+eA6veRvilVmy UirLd5vkRPRGBo+I1ly2Xvbxokpn1Dqc6B3D6LqO5i6wDYHaWsgeXCCRRFCgLlzynh dQGRcAPlbF2kNfc1zux8vziOg0p3Uydx9mspC9pVPSXnlIyz4kX6Qvdy21OPBlFK58 U2mp+aS1bq6XQ== Received: by janitor.denx.de (Postfix, from userid 108) id 0FD3EA021F; Wed, 24 Nov 2021 13:22:32 +0100 (CET) Received: from gemini.denx.de (gemini.denx.de [10.4.0.2]) by janitor.denx.de (Postfix) with ESMTPS id 48095A0099; Wed, 24 Nov 2021 13:22:26 +0100 (CET) Received: from gemini.denx.de (localhost [IPv6:::1]) by gemini.denx.de (Postfix) with ESMTP id 25C101E1813; Wed, 24 Nov 2021 13:22:26 +0100 (CET) To: Mattias Hansson cc: u-boot@lists.denx.de From: Wolfgang Denk Subject: Re: [PATCH v2] tools/mxsimage: Remove fclose on empty FILE pointer MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit In-reply-to: <20211124121049.24054-1-hansson.mattias@gmail.com> References: <20211124121049.24054-1-hansson.mattias@gmail.com> Comments: In-reply-to Mattias Hansson message dated "Wed, 24 Nov 2021 13:10:49 +0100." Date: Wed, 24 Nov 2021 13:22:26 +0100 Message-ID: <2820371.1637756546@gemini.denx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Dear Mattias Hansson, In message <20211124121049.24054-1-hansson.mattias@gmail.com> you wrote: > If `sb_load_cmdfile()` fails to open the configuration file it will jump > to error handling where the code will try to `fclose()` the FILE pointer > which is NULL causing `mkimage` to segfault. > > This patch removes the label for error handling and instead returns > immediately which skips the `fclose()` and prevents the segfault. The > errno is also described in the error message to guide users. > > Signed-off-by: Mattias Hansson Reviewed-by: Wolfgang Denk Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de Time is a drug. Too much of it kills you. - Terry Pratchett, _Small Gods_