Message ID | 20191123132727.30151-3-yamada.masahiro@socionext.com |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp735694ilf; Sat, 23 Nov 2019 05:28:04 -0800 (PST) X-Google-Smtp-Source: APXvYqw3snEKqVLCdNGXskqJ3ylYxT6R5VouT/Pqay7fcoS/gjlq6cv+1KHwU+bSQzfm7A5BMrEK X-Received: by 2002:a05:6402:17e7:: with SMTP id t7mr880645edy.114.1574515684567; Sat, 23 Nov 2019 05:28:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574515684; cv=none; d=google.com; s=arc-20160816; b=Arlb6fFUeiRQgTEalRtJ6w6ZI0rckun2PKHzXgv6mVMSfv3owpsKY3QdMAofIH7zGa 4SeBeVKKoGQRbZycLSUJZ5YlqCbHke+WorqmR/HCVMBNjIGMuEUttQZifr6JqybV7m3I rIhlzKrt/wJuBXu0Hu8t7yl7FpP28LUkd1enhnE1SpeEv6+gtnMCOBfPek95b9XdmnAg GP2CQHDjlERA3PHotsL/ZvYWe3HXsbj4n/NKO4Ct86V1rM6NXuCC0Fa3O0HdCbXDR6NT gO+by27uProAe2nJ46ooxFzh/BbmbF55QIPwnJQcpQg8R0hkDtfvnK3/Uisy9YdXr9gy BF/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=JLQ/nMugg5YVM+foR8VQqNloJc4DhmgRZ+4CrOZuEX4=; b=TJHggUaEydBC6ODs07TKkF644iqZd76ZYfIMLPMITiOyUvzZSSAPPbMNgQ+lVDRK0o enoWqqzPB8dJDajqHoBJskoTOS3QZz4k0ke5Nf6mS6KxAWDfxcyOBpNlwRR2duns1SY3 RnhF1zemZBCcPt8o78HIJrkj6SxETGSLsupIwHG3dhP88qGbBlsreTmOrGl4j2Qmnrja HJX7GxJ6djT4W6TgCBuP7cER/mbI+Up5a14vWXQPEIX+tV5zq6FrXVIl2qAYZc3S7/TW lOIgJFP0yTvmvDcQeLO6yypZRh37xy77DHvtRXFmHC7E1BDFzENvbMOoTe2K8PTVe2Fu A6Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=YlRnKr4T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si817912edt.196.2019.11.23.05.28.04; Sat, 23 Nov 2019 05:28:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=YlRnKr4T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726937AbfKWN2B (ORCPT <rfc822;lee.jones@linaro.org> + 26 others); Sat, 23 Nov 2019 08:28:01 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:39550 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfKWN17 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 23 Nov 2019 08:27:59 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id xANDRbkb000733; Sat, 23 Nov 2019 22:27:39 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com xANDRbkb000733 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574515659; bh=JLQ/nMugg5YVM+foR8VQqNloJc4DhmgRZ+4CrOZuEX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YlRnKr4Tk7d0Czt/xTJcgSf5lnYUu2xV02JwJ71fH12BaC/fHaPJDlCF0pG/sYmQx aXtYH7PnNvV2VLk89VcXdKbTXRAaNs0tu4j5UVmtMU0ovsHmf7U7xTDEdBNoAclqP8 korgTc4lM/6/z9UgWSuQsPMdCQoBM/DL3+MD1v/JqwU9XpKWR5w8uVTaqimecsThdM P0hfUMzntuaYspaOTxbSd/eGO6IHVmf5CNzd7qdftSZ1c+2+NKIZt0RMOeHQz3JKYR D8hRO9bnbrXUKZPVa2eS/D9NcT/DOoGoaeJTO7C4j8+RcetSo/hdum6V0q36G5u65z WGMpgJ6Z/JcVA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada <yamada.masahiro@socionext.com> To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada <yamada.masahiro@socionext.com>, linux-kernel@vger.kernel.org Subject: [PATCH 02/16] scripts/kallsyms: fix definitely-lost memory leak Date: Sat, 23 Nov 2019 22:27:13 +0900 Message-Id: <20191123132727.30151-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123132727.30151-1-yamada.masahiro@socionext.com> References: <20191123132727.30151-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
scripts/kallsyms: various cleanups and optimizations
|
expand
|
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 918c2ba071b5..79641874d860 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -487,6 +487,8 @@ static void build_initial_tok_table(void) table[pos] = table[i]; learn_symbol(table[pos].sym, table[pos].len); pos++; + } else { + free(table[i].sym); } } table_cnt = pos;
build_initial_tok_table() overwrites unused sym_entry to shrink the table size. Before the entry is overwritten, table[i].sym must be freed since it is malloc'ed data. This fixes the 'definitely lost' report from valgrind. I ran valgrind against x86_64_defconfig of v5.4-rc8 kernel, and here is the summary: [Before the fix] LEAK SUMMARY: definitely lost: 53,184 bytes in 2,874 blocks [After the fix] LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- scripts/kallsyms.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1