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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B080C433B4 for ; Thu, 15 Apr 2021 07:25:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEDB5611AB for ; Thu, 15 Apr 2021 07:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbhDOHZu (ORCPT ); Thu, 15 Apr 2021 03:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbhDOHZt (ORCPT ); Thu, 15 Apr 2021 03:25:49 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C154BC061574; Thu, 15 Apr 2021 00:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qIUuzFbM5Xu+iHP+ZYetd8xb2tkbqd4x6+aFiWRS990=; b=BxvxQo5kHKlbeo6LBzqzVUuR7y E8nyNJVa/LsIQg1XXQmrG+9IQ26U2jgSj3WP+T1sLkHoGdYWod8YIWPLFZcss7xTiU5wJZlXUI/3A lfskGSgjCWhuNYWrMstBdAVbku/FURyQAhY9VAg7mQBGQjeK7Hdmxw7THxScyf35kqPX+4eO0uMBI TV+WqJ5IuVMMMqwMhop+O+lMlb3Gd4qVY/sLLBOtWpHAFPPt3ma0GoDo49TLjr/qNX2DBeQxWKO39 /SsV9Mx6EFw9O5x0uJJ7F2SKRjHWzPpaxslfs6eLcg6dFpfAYflLMq4dx4gkkgTP1kI91cAw/6DK7 2mz1yxLw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lWwMl-008C72-5N; Thu, 15 Apr 2021 07:24:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C7F76300209; Thu, 15 Apr 2021 09:24:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B22EC20BF5EFA; Thu, 15 Apr 2021 09:24:41 +0200 (CEST) Date: Thu, 15 Apr 2021 09:24:41 +0200 From: Peter Zijlstra To: Dan Carpenter Cc: Muhammad Usama Anjum , Josh Poimboeuf , Ingo Molnar , Miroslav Benes , Borislav Petkov , open list , kernel-janitors@vger.kernel.org, colin.king@canonical.com, Arnaldo Carvalho de Melo Subject: Re: [PATCH] objtool: prevent memory leak in error paths Message-ID: References: <20210413204511.GA664936@LEGION> <20210414084709.GT6021@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414084709.GT6021@kadam> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 11:47:09AM +0300, Dan Carpenter wrote: > On Wed, Apr 14, 2021 at 01:45:11AM +0500, Muhammad Usama Anjum wrote: > > Memory allocated by sym and sym->name isn't being freed if some error > > occurs in elf_create_undef_symbol(). Free the sym and sym->name if error > > is detected before returning NULL. > > > > Addresses-Coverity: ("Prevent memory leak") > > Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()") > > Signed-off-by: Muhammad Usama Anjum > > --- > > Only build has been tested. > > > > Just ignore leaks from the tools/ directory. These things run and then > exit and all the memory is freed. #OldSchoolGarbageCollector Mostly true; but I suspect tools/perf might care, it has some longer running things in.