From patchwork Wed Apr 12 07:49:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 13208595 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 02518C77B72 for ; Wed, 12 Apr 2023 07:49:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D840900002; Wed, 12 Apr 2023 03:49:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6888E6B0075; Wed, 12 Apr 2023 03:49:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 576B7900002; Wed, 12 Apr 2023 03:49:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 491136B0074 for ; Wed, 12 Apr 2023 03:49:35 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0DC2F41014 for ; Wed, 12 Apr 2023 07:49:35 +0000 (UTC) X-FDA: 80671964310.06.E36151C Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by imf23.hostedemail.com (Postfix) with ESMTP id 1F622140003 for ; Wed, 12 Apr 2023 07:49:31 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.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=1681285773; 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=cPiMsje2YmGhoCbwPgaRTkEm35j/kJOySqNNdSmsJhA=; b=QjypuNJuPil3KAzZ/zv9mGBBIHR0LqBT1EMjuiZninBUcKeXURiUbmhsAerZnzQkvLnmYp TX1rOmjB4L3N8uSN+yLnFNwZG64wJgJqyIgDTLvQY/EO+DwmvqIoockSYHMCTtHanHj4Bd S/O6ZE0/tjqhUfAkW4+mW8EYiU7bMyA= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.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=1681285773; a=rsa-sha256; cv=none; b=gNQx5O/086emxDIcI1kadScQcWZCO725XztL9CK0Q0ULz1k5Q8Zz0PEZkaeL5TKYC5wXj9 n9Ti3+QOn+DzDeKr8udVs0VfbKeLuvp3WLVsDT8D8H6vyqVsDIlwDOrMSR4iWv7Edrk+ng W2docmlrOqudA864m5V+2pqKtVRq874= Received: from unicom145.biz-email.net by unicom145.biz-email.net ((D)) with ASMTP (SSL) id HBJ00027; Wed, 12 Apr 2023 15:49:27 +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:49:26 +0800 From: Deming Wang To: , CC: , , , Deming Wang Subject: [PATCH] mm: huge_memory: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 03:49:15 -0400 Message-ID: <20230412074915.2303-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 2023412154927bed2c8f64373bf4344b6b1b5d5e3769a 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: rspam04 X-Rspamd-Queue-Id: 1F622140003 X-Stat-Signature: e8asn6a9fajzxs19buy9idaa3ejpxnej X-HE-Tag: 1681285771-330913 X-HE-Meta: U2FsdGVkX1+H+ftM5YWL2baJVJz6Ym0X9/L9h163CgcJk++kJ3JKHd1iZJHb/uKmAc5JDdRN/9XgjtJSERVsjt657vczWiqNehGt8+uA1hv4vCvBuVs4sUKlX4IeLGe62XySaXtW8TPjcAfw7spQg4Ie2hpRx4TXU8uFvbouPl9d3XbGvMfV7DItlofXS/2GuDAF/g3HTYw9wNLprcZuPaDkRzPhWDIZ7hXYv3jx9GlLsXhSIY9E6+GJOnn0faJ1AclIY1eCI2UgaRpzbCGqLUroX22nj5e4BPghbkcYLDfM2dvLLvgCO+OyVHCLigzHv2zHHQrC6G2OrWM/ZK3Bnnx8HbAx836ACF8b13/QZa8/vUFL1IC2T5thJEAjfBfgTNk/vnbPhqEfGeaB1vwhZWtd+JocOE/AKKw4hVyw3ALnLHNnlQkfJ+tXkZh4fR6Szd/OrcdsL4EObUryk5cQyYXlCU6j7CseGU35UhR09eXnede5Aa63chPFzM8Xs99aQt7ph8Yu1zvnr7v2Whh2Y6rTiqwzJDNMzV8RsirhYBLV6Z/lP17FPU49WEV+tPeaDa0G6RTNMaItfBQYhy786BdQGklO2bgVcwDfJj5S0FOx0stcRvJ/IGJ5wgAHaErNzFfmI+zvQMgNJ0TX7vPrwRVzdV3Jv5Fpnxy0P6M/cnCqmNhTaaAfr+ILydtZpBRWUv9cvN4Qvkj6MkPBULxIhbKoifKzcLgtRbw9kW9qA8EBr2nNw0hKI94WjXeiA2+jfmrspU7RoIDH4J2ZJXyRGAZNQLRruGjUBe7xNAF8aedrfM9JYapotjGitpIWtXMAzIRuIG027hI4L+YSUZcmBIttWbAOaXh8pTt1w5zcw+xeBtRW7z7ENnfhyjiGMee8RYZHxXA7katz8i5NvBQBG9Yilpx+I12yFzJ63ZJpEVJbTFQRL+du+OG87aJ9YYt3DcwKNAmFszvixlzXcYq /xO2SxQr tEUBFUKPxkWO5+XJkFiyBtKMJTFo5NHUe0pfBQg24KU78XhKlugGXIKm2sI1YnRvjCinmuxBuZC5CY5WyZ/LXTJOW7u/bYpFP9BaPf/a6Loc4rm795cRWTI9RGpSKfPK1m7V8JgBWBJbWtY2hEakjmNLTYccu6d2CVSW6Np5Dzc+gBO02Ln4Cg3GNRlYycJVoMLsXm/IQ/twpjkfY7IFPl4pJ0Q== 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() 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/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..8f48f07bc821 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); }