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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D319C636D4 for ; Wed, 15 Feb 2023 13:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231881AbjBONG4 (ORCPT ); Wed, 15 Feb 2023 08:06:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234117AbjBONGn (ORCPT ); Wed, 15 Feb 2023 08:06:43 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C1F38E81; Wed, 15 Feb 2023 05:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676466396; x=1708002396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ATWdTIj6nlHosfxRj2cQEQ4dZAgek4AbNN/n59hIx9E=; b=TbpsbkpIrsubjjxbWHiTBvoESEjnbU4eSJ1VO4a7FwvPx9sQMkzsyJgn KOfl3aCvk1wtQX2lzcD0ERrQR3FhvHN+oc3U090cqCRDmxW9CMyWndz2U dhF6NAgjdxiFju1ftEj1GSSmKMWLwtuQsIg7kJYuAusNL+YNgbCm1GHcA AzvA1X/XTDUPa3aocRkXHRTx+LWE7OPSKoacyzUclPfv542ReQoXhb+ul jraNiX886Fwb36ItGkDjHQ0yGBbBlTZlZyzi96C8nUdsyfDVV2IEGaeUG YzRaoaVxDM9WN/q3wGth++vHWheSnoZI+mFOxMw4kzHZNhc6Wz10cstmo A==; X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="319456280" X-IronPort-AV: E=Sophos;i="5.97,299,1669104000"; d="scan'208";a="319456280" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 05:06:35 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="812436072" X-IronPort-AV: E=Sophos;i="5.97,299,1669104000"; d="scan'208";a="812436072" Received: from hshannan-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.49.120]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 05:06:33 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre , Fenghua Yu , Shuah Khan Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v2 5/9] selftests/resctrl: Replace obsolete memalign() with posix_memalign() Date: Wed, 15 Feb 2023 15:06:01 +0200 Message-Id: <20230215130605.31583-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230215130605.31583-1-ilpo.jarvinen@linux.intel.com> References: <20230215130605.31583-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). Suggested-by: Reinette Chatre Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/fill_buf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index c20d0a7ecbe6..3cd0b337eae5 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include "resctrl.h" @@ -64,11 +63,13 @@ static void mem_flush(void *p, size_t s) static void *malloc_and_init_memory(size_t s) { + void *p = NULL; uint64_t *p64; size_t s64; + int ret; - void *p = memalign(PAGE_SIZE, s); - if (!p) + ret = posix_memalign(&p, PAGE_SIZE, s); + if (ret < 0) return NULL; p64 = (uint64_t *)p; -- 2.30.2