From patchwork Tue Jan 14 02:38:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ye X-Patchwork-Id: 13938333 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8695C02180 for ; Tue, 14 Jan 2025 02:38:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A68F280004; Mon, 13 Jan 2025 21:38:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 456C2280002; Mon, 13 Jan 2025 21:38:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31E3D280004; Mon, 13 Jan 2025 21:38:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 124E2280002 for ; Mon, 13 Jan 2025 21:38:57 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B778680560 for ; Tue, 14 Jan 2025 02:38:56 +0000 (UTC) X-FDA: 83004499872.03.D8FD328 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by imf09.hostedemail.com (Postfix) with ESMTP id 0F79714000A for ; Tue, 14 Jan 2025 02:38:52 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of liuye@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=liuye@kylinos.cn ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736822333; a=rsa-sha256; cv=none; b=Y835n8FZ3FbIO7Pni1MkoAk/J6WgVwUc+vqBRr6fnTlnCUMUngvk73ulrCiTiAmy4Ax8si t5nub3STUz+L/2CuHIq/ExuP9v2ILeYKK9XueQ0Z8EkSKTtBoCZL5cvyHWxLtnYGFBcNKL gcVsJQ3u/JB4qLw9Dj0NNHOL7jesu4Y= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of liuye@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=liuye@kylinos.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736822333; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=PxzSPbzNGQDVQ6AjcS/7SMhO55dBkV1Nzk6/1oU0xco=; b=ZlYK5PzS1uKzlg/sfP7fOPQ2e3cKrfFLPp0t9Zdafhw9qemanYDFNHsT2HgUhpx1IKqqb1 +0ylRL6M0r3G/bpi0I/M781Su4gnSW7QHkwWjph2nUX1WxaNCM8XerBeo6rj+3FEztIRvg dKcBlVPRTf8pVEZwwqL15qdA9mSMHB4= X-UUID: aca147ead22011efa216b1d71e6e1362-20250114 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM, HR_SJ_PHRASE HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT, HR_TO_NO_NAME IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_EXISTED, SN_EXISTED SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS, CIE_BAD, CIE_GOOD_SPF GTI_FG_BS, GTI_RG_INFO, GTI_C_BU, AMN_T1, AMN_GOOD AMN_C_TI, AMN_C_BU X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:fee4e13a-7370-4fe4-8369-4e8123aa97a5,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-5 X-CID-INFO: VERSION:1.1.45,REQID:fee4e13a-7370-4fe4-8369-4e8123aa97a5,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:6493067,CLOUDID:29c75f80375dd1e9a92c84609f06fa94,BulkI D:250114103846GD9UCBC9,BulkQuantity:0,Recheck:0,SF:17|19|24|38|44|66|78|10 2,TC:nil,Content:0|50,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,B EC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: aca147ead22011efa216b1d71e6e1362-20250114 X-User: liuye@kylinos.cn Received: from localhost.localdomain [(223.70.160.239)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 813885902; Tue, 14 Jan 2025 10:38:44 +0800 From: liuye To: akpm@linux-foundation.org, shuah@kernel.org Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, liuye Subject: [PATCH] selftests/mm/mkdirty: Fix memory leak in test_uffdio_copy() Date: Tue, 14 Jan 2025 10:38:38 +0800 Message-Id: <20250114023838.48589-1-liuye@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Stat-Signature: r9zg1tf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xA8T ewMRhB2s QoC2jH7Y7LFQKKqsu8xLpcbzhhT9mOMTzdZ/8xIV6qO2BDjDUZd6iBRw60NaL3ps1xLnyRtsIlJdWThDaEiW6LB8uUBd9NHHTgaqu24jL8ahXDuo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Release memory before exception branch returns to prevent memory leaks Checking tools/testing/selftests/mm/mkdirty.c ... tools/testing/selftests/mm/mkdirty.c:283:3: error: Memory leak: src [memleak] return; ^ Signed-off-by: liuye Reviewed-by: David Hildenbrand --- tools/testing/selftests/mm/mkdirty.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c index 1db134063c38..af2fce496912 100644 --- a/tools/testing/selftests/mm/mkdirty.c +++ b/tools/testing/selftests/mm/mkdirty.c @@ -280,6 +280,7 @@ static void test_uffdio_copy(void) dst = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0); if (dst == MAP_FAILED) { ksft_test_result_fail("mmap() failed\n"); + free(src); return; }