From patchwork Thu Apr 13 01:17:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 13209697 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 B807CC77B6C for ; Thu, 13 Apr 2023 01:17:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B7E2900003; Wed, 12 Apr 2023 21:17:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 068436B0074; Wed, 12 Apr 2023 21:17:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9870900003; Wed, 12 Apr 2023 21:17:30 -0400 (EDT) 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 DA26E6B0072 for ; Wed, 12 Apr 2023 21:17:30 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A8106C01A4 for ; Thu, 13 Apr 2023 01:17:30 +0000 (UTC) X-FDA: 80674605060.05.6527D98 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by imf16.hostedemail.com (Postfix) with ESMTP id 6D123180027 for ; Thu, 13 Apr 2023 01:17:27 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681348648; 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=o3wC8Aqj2Wfkp+6OeUzTDK/2hts0qS7kLW0uA/tAChg=; b=zOOGzg9+Uy/D4QOYu/up5+m2wxWYx359LWwfHDfNAu30BA+XwT+f8CWgQhet8tzDJMqssc JuGgyYr2BH1IN5RND45BRp8Lgxlk0pR/+fTu9vIOIqG254CEZCHY5RKm+1aoh8hLh0va71 s7bYH387/9BUlqgcT6Izkjlhf4Ni8IQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681348648; a=rsa-sha256; cv=none; b=O+UHkPn/2bqW5gmBzxfdeiJB+w9eVR6RJPmkP4PaYR98o30olgVs+bgeZEC5HUtw+TUMGZ eDZaIwrsDeDfm4eHCwEqx0AIOAxaIJK0WD3Ge7GWKLZO8uuI25fLYTfl+dFGZihzH4zpBR Dk0gwPhOpuj85zmyiqb6UwRBVWLRcbM= Received: from unicom145.biz-email.net by unicom145.biz-email.net ((D)) with ASMTP (SSL) id IVE00021; Thu, 13 Apr 2023 09:17:21 +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; Thu, 13 Apr 2023 09:17:21 +0800 From: Deming Wang To: , CC: , , , Deming Wang Subject: [PATCH] mm: huge_memory: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 21:17:19 -0400 Message-ID: <20230413011719.4355-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 202341309172112133dcf85e55cc2f0c8dd986110b309 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-Server: rspam02 X-Rspamd-Queue-Id: 6D123180027 X-Stat-Signature: rbndg3w4p1kj6akrsii51rnzeog7k5pm X-HE-Tag: 1681348647-538114 X-HE-Meta: U2FsdGVkX1+mpNnKuUhsOS9j43DxJgYX86Z9A6VDBbUmB7tGFoRZIwmtc+l20MH+7iIvSrDhJOWukHw805ykDCoqzGHwJP2aMfqlOx2NQyS2Eyn4JDpVNEY6hIjpsu6m/G6lOOLSYX/0mwG0CJdh32uzV6WyGuXLjwRT5SY0PVgi1xdLnMrXFF5o7vtAfJFggPUW8aALh2Ifn6k4AdorJn6EpxPDRJBbhQetHMd365uOGZ/9LOG9RHDQqeU5KSLHDUktSCn8Aykjz/CJFLrBUU0UVCI1QPOJG+JtgvudSuCLqMJFdDqtWJaU9VrSGs1YD9nR2y0a9+rUmvfCB14x+dZTljTADCLwTJAmOnOuwwgBXem1keEYUw/iknzwsGlfgFCGizj0z1j2Z5j+Rx2fizpMxrS741hrScZZYGXNtj+NBEsft6Rr80B6wUoMIsSQH0leUs5NbpPpSnnE68+z3jiKdcLbEBEOF40hn9SHTfCvrljxPZAxNkU8ggmQ1KYqUOHhTVifNROEpV+OU0kLbWOPiX/Kg/zeaXMByrnUJ1w/ynIxzvMbGRpCOU/cCULPlaUD658/hIqITgjQ04H7z6RaR/roB/OIWBrx5TKnyGXBFQojHFyaFfz+oy8pRSWkUHQ5pnQKy7n4pRlkwWeOkNF54A+hptJIH8h1qI2dxS0oIYLvp0AdemsW2NgHLKqGSV6BM2ioXaaVrXa4h+KnwrN5TscHGP1SC/vXyhfqU866Zjzg+JAR4/MFHeuhBzkVXrPjNNnQQ3lbmwmrraVrF35SmFQuWmPrqq/71OEGOq0ofzR16qkyWDo2XUQybgjx98hnFnQeJprKqHNZSaTIAEWjYAnHTmpZXjKR6/Q0bFtwZnMsWw7E4kGEIqdaKWodZPPoVq+0HkqaQ6kAWzjQlX4BuTQd6II0K744a9udxb2gA1b3YAHvKHdv+3S9Qdmsq88KpQmf17HwsPKrvyJ pQa+7nSk X1g+tcTt1d+1Ycq/vVWFw5dnD29bpLqCI/b3y9ipMdx5VMMvXSzgHDkHdQB0kIEosHYH7EOqLxO6bICcPayoF0Z+4T87Mj6ITPQG2N9nvdZa5OOuCLezZKhm87lkDRe5BrxNd5K6tvsegHBkXjDBBH+TyKU2wTk+vNT9OuBl6GX0WZH91AzaCdC31mxBR2zw8vsxon1jdtMLdE/fQ6xmXxVFxQQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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() As a pointer is passed into posix_memalign(), initialize *one_page 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 one_page is returned). Signed-off-by: Deming Wang --- tools/testing/selftests/mm/split_huge_page_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index cbb5e6893cbf..94c7dffc4d7d 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -96,10 +96,10 @@ void split_pmd_thp(void) char *one_page; size_t len = 4 * pmd_pagesize; size_t i; + int ret; - one_page = memalign(pmd_pagesize, len); - - if (!one_page) { + ret = posix_memalign((void **)&one_page, pmd_pagesize, len); + if (ret < 0) { printf("Fail to allocate memory\n"); exit(EXIT_FAILURE); }