From patchwork Wed Apr 12 07:27:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 13208588 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 DBD2AC77B75 for ; Wed, 12 Apr 2023 07:27:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECF64900003; Wed, 12 Apr 2023 03:27:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7FCE900002; Wed, 12 Apr 2023 03:27:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6DF6900003; Wed, 12 Apr 2023 03:27:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C36E7900002 for ; Wed, 12 Apr 2023 03:27:52 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 94B71120F66 for ; Wed, 12 Apr 2023 07:27:52 +0000 (UTC) X-FDA: 80671909584.01.42DD017 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by imf10.hostedemail.com (Postfix) with ESMTP id 9358FC0021 for ; Wed, 12 Apr 2023 07:27:49 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681284470; a=rsa-sha256; cv=none; b=K7ff8ZS78K0eFVBfY7ZhJmcVVWZqSt/chPSfpQRJC2shDKdPT9zpMf7zO+qUesx7PZL7Fz 44fljp4ZV4KlUfqkbW7YLLuwAllJVH7i5FsBSw5OCrC5QnYCkSrnp1kuKDsFXRSusL9BIe ARXl2H1xy4oyKex7rp89Wh7cew0mSgQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681284470; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=dsyPCT9IUs5y+9V7Nrnd9oeMKjsOs/BbtVPFlNvKtRg=; b=42nm5XtHbQbZ3aU/ZmIN4xWR9NZ+zuWvjqOEiL+ZEkOfo3TohCDT8WWXbgoikIR2mxDZ0m ZDFEdASPe9GPi0g5KlaIXZmi7exhLE44PSTd4f22iVQxWjl8SVE3AfA8bE/Lr1UJmwPIVE 2DNXTHRMbJHpZ4Ccv2LCBGAAr40mesI= Received: from unicom145.biz-email.net by unicom145.biz-email.net ((D)) with ASMTP (SSL) id HBN00145; Wed, 12 Apr 2023 15:27:45 +0800 Received: from localhost.localdomain.com (10.200.104.82) by jtjnmail201603.home.langchao.com (10.100.2.3) with Microsoft SMTP Server id 15.1.2507.21; Wed, 12 Apr 2023 15:27:45 +0800 From: Deming Wang To: , CC: , , , Deming Wang Subject: [PATCH] selftests/mm: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 03:27:41 -0400 Message-ID: <20230412072741.2116-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 202341215274548ec1c667233f2549d7fa375c53b6f05 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com X-Rspam-User: X-Rspamd-Queue-Id: 9358FC0021 X-Rspamd-Server: rspam01 X-Stat-Signature: 689dzehpftgz813jzsi1phf7agahk3s8 X-HE-Tag: 1681284469-637713 X-HE-Meta: U2FsdGVkX18QkLGwJEQrsv5D7t4umQceapPNvxTTPSvepnqJ1rLIp5UyspRybYyuSf/42EGAfusUeXmg70lOH79BIa68Pa4aAHsnHxbD9QlsYnBsQ770AwOh5+1D8UQe0uDI7xSjQIr9vgmLLPT6vrLQe/ryKFEIIKQHLcrCBDQzBO1pDelJs8ds7ALI4ZwmS2tvzr6HjESLxlUrzJ5D30Vy2qBRyX/f8WXXKP8fjvUHJEWjl7phO9cuGi2kg1DH2sc40cmMqIOnmCeF2h4cfWTSeQ4C+AoNFmaqSWnS4f90ddh+qqhrLhZDZDCX3okxCvtKqphtqDd19LjoxVlNuFNp8twAruU/4Y7QNrEcUWIripFvyOYx+qUSDQt9w9+1x4STmGAV/tAkbtOZuTbgxdRVox82T+ekSC4ADSygE1mmFXRJrRQ7pRJ+2sXSRSHFoupOS6BT1zmBFh9QM7b4aRsP4wS3zwdLzHAGTycFtx9P61xOYDrzGf50FX2YkLvp2lhsrJ4nFQ5czl+dRmLVaIeG3O+eA5CfGF16yS3afzMU/iAxfVccTaFlmlCCp/n4ibBI7ZRwju9cLBiaVKMizoLX4IUieW4msmpr4iGG1FJJwvOxdD5W8NKix4Z53oRAWKu2HUPVGApmCqNfXbgyfAfPvMACrHLq1S4YGpxpM8exGZGuxSO8/Lbz7VFuWbxg8KKpMBgmuFl7z6gewCayJfqAUIBv0IHp5RxiCfv89WT4PX7lqdT1bBlFfouXJJHliM3qG2Ss1ezdW7plKoDtMvDRL+3xYDnXSuAkGf80llcPAIMblgWYF3nExs6JqOQ6JuR1JsnfwUTiTHoqRiV6k0d1FISjzMP+oSfuKTMS9tB/fy0MReXc7WFvg49CZBk0pjvzDBMw3x8Occ2y2P13EsA2mzMuAJCBl//RaTOEu9sZekf3u7tNXfZxeEU3mF/qJjM80+afFpaW2rCT9qR FMbreyAi KCI9wTUPRQyN6tVUgCAS5CfRKClArCrYcEfdbqydd0D3Fs0oin9adw8cWziAkroVmJqBvZ+7incswm9m0UUDiWfplEhHS/mDxnzEvR5HyOEpWmqGz6rG4oT7CGTASch5X9aisZS/77GxGK7uVhN1QN4c12nKHd/9urLOX9uaaWXazkeZ6h+BIwXHrOQdezu/SKccK+wyse9OQ+lhWTAVtosM6NQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: memalign() is obsolete according to its manpage. Replace memalign() with posix_memalign() and remove malloc.h include that was there for memalign(). As a pointer is passed into posix_memalign(), initialize *p to NULL to silence a warning about the function's return value being used as uninitialized (which is not valid anyway because the error is properly checked before p is returned). Signed-off-by: Deming Wang --- tools/testing/selftests/mm/soft-dirty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 21d8830c5f24..4bb7421141a2 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -80,8 +80,8 @@ static void test_hugepage(int pagemap_fd, int pagesize) int i, ret; size_t hpage_len = read_pmd_pagesize(); - map = memalign(hpage_len, hpage_len); - if (!map) + ret = posix_memalign((void *)(&map), hpage_len, hpage_len); + if (ret < 0) ksft_exit_fail_msg("memalign failed\n"); ret = madvise(map, hpage_len, MADV_HUGEPAGE);