Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp677955rdb; Tue, 15 Aug 2023 08:44:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbGJqh1ecOnORosFAHjSAC1sXkRlOTpH4IuYl9P+EKJMAtSV4ih9KyeXtFkFsmMYkhnHBM X-Received: by 2002:a17:906:7396:b0:98f:8481:24b3 with SMTP id f22-20020a170906739600b0098f848124b3mr2165733ejl.37.1692114269303; Tue, 15 Aug 2023 08:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692114269; cv=none; d=google.com; s=arc-20160816; b=sVH/k4h00CxiA1dVJHjSyQL/xstchmCGOx/D6s/8VPyefAj0NvREzA8hLa/3CbhW40 650fk2Hy9xzUQF5m1AApJ4dp4Z2NONcTq6D+ze29pBQVNjbaUZim6hOjX6DnL2Rdh6G9 MjMXnPHGTbzK9k88LoAg9aK8jH0kNvnkpRfs8iDBtzeLlHfuQapxNKG/6tPZp/pQ7KPq ZqZFc6MvWteSk3lafm1nkdcLYNF5VteK5ncHsJKBpc8hslbnPoL2ilZ8yRiJVHNUMo9k 9vFalTclnbrwOhy3BFZ6LVSRWNn1vYKnoU55/JE62vmysOiT7sikPzvEVXXUlzpV5x9b uN8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XRFn1vz/li9u9//ZL9kvaGIZg/HFQE16o9FYMqdNn+o=; fh=GleBkPKnmXrDco/1H2o/NrSOat4lSVrFA4fkG91zkMA=; b=yqJvhBGhEkFvbIpYtOsCs9grZUzYytgVM2No8prDfvYtH/lSjVmNujsVvdS+S//BI+ n7C77kPmTogkSLPFGlcUswJFlAC0qT+L68OplM0bs5farSDSqnDT2Vx0qv0MzgB4HKmp tsDCU/KwNDUDO3PIXD9q5xC35WFq/NTYPKggXsudjTjCTkfvefifkJLLJNi+k2+zd6ml BcCsMDzgU8MPXZux5TIeIuP4TECgGTcFippaw4o2cOT/1/MDiT2M6wWEDHM6Sgt8bjuk VtJDN4Kchkvo7ZPjlRwbEoUa0P+4KppowLZQvx22RCHBxPUONoDhEB/6kA0okM1hKSWl FiLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lm17-20020a170906981100b00993b3881ecdsi9474954ejb.687.2023.08.15.08.44.03; Tue, 15 Aug 2023 08:44:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235448AbjHOHwx (ORCPT + 99 others); Tue, 15 Aug 2023 03:52:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235459AbjHOHwZ (ORCPT ); Tue, 15 Aug 2023 03:52:25 -0400 X-Greylist: delayed 183 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Aug 2023 00:52:22 PDT Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 050FF173C; Tue, 15 Aug 2023 00:52:21 -0700 (PDT) X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from cmccmta.chinamobile.com (unknown[172.16.121.91]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee464db2dfcaf7-10c93; Tue, 15 Aug 2023 15:49:16 +0800 (CST) X-RM-TRANSID: 2ee464db2dfcaf7-10c93 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.108.79.101]) by rmsmtp-syy-appsvrnew06-12031 (RichMail) with SMTP id 2eff64db2dfbec0-66fe9; Tue, 15 Aug 2023 15:49:16 +0800 (CST) X-RM-TRANSID: 2eff64db2dfbec0-66fe9 From: Ding Xiang To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kselftest/arm64: fix a memleak in zt_regs_run() Date: Tue, 15 Aug 2023 15:49:15 +0800 Message-Id: <20230815074915.245528-1-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If memcmp() does not return 0, "zeros" need to be freed to prevent memleak Signed-off-by: Ding Xiang --- tools/testing/selftests/arm64/signal/testcases/zt_regs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/arm64/signal/testcases/zt_regs.c b/tools/testing/selftests/arm64/signal/testcases/zt_regs.c index e1eb4d5c027a..2e384d731618 100644 --- a/tools/testing/selftests/arm64/signal/testcases/zt_regs.c +++ b/tools/testing/selftests/arm64/signal/testcases/zt_regs.c @@ -65,6 +65,7 @@ int zt_regs_run(struct tdescr *td, siginfo_t *si, ucontext_t *uc) if (memcmp(zeros, (char *)zt + ZT_SIG_REGS_OFFSET, ZT_SIG_REGS_SIZE(zt->nregs)) != 0) { fprintf(stderr, "ZT data invalid\n"); + free(zeros); return 1; } -- 2.38.1