Message ID | 20210726153830.613854294@linuxfoundation.org |
---|---|
State | New |
Headers | show
Return-Path: <stable-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4025C432BE for <stable@archiver.kernel.org>; Mon, 26 Jul 2021 15:51:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7AA460F6E for <stable@archiver.kernel.org>; Mon, 26 Jul 2021 15:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236314AbhGZPK5 (ORCPT <rfc822;stable@archiver.kernel.org>); Mon, 26 Jul 2021 11:10:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236357AbhGZPIQ (ORCPT <rfc822;stable@vger.kernel.org>); Mon, 26 Jul 2021 11:08:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C1AA160F59; Mon, 26 Jul 2021 15:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627314511; bh=Xx4TdN3LRW98yyInq1cNQHG2ShyTMjifHR9k2mHWRtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=okWDTSnrZk1KcVDHQaqhvujGptweTobrfrIZnd4mISZTegJaKnLZ8JpJo/VxET3Jw /imcLojMuDBHlPQWySjhCjmOAQ6K2/+a3yjLoQnN0y5SU6VScH309dZTwSNWUegGTj kuVos91Ccj5BJJpv7tcf+Xielrv9goWR4u42now4= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Lokesh Gidra <lokeshgidra@google.com>, Peter Collingbourne <pcc@google.com>, Catalin Marinas <catalin.marinas@arm.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Dave Martin <Dave.Martin@arm.com>, Will Deacon <will@kernel.org>, Andrea Arcangeli <aarcange@redhat.com>, Alistair Delva <adelva@google.com>, William McVicker <willmcvicker@google.com>, Evgenii Stepanov <eugenis@google.com>, Mitch Phillips <mitchp@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org> Subject: [PATCH 4.14 75/82] selftest: use mmap instead of posix_memalign to allocate memory Date: Mon, 26 Jul 2021 17:39:15 +0200 Message-Id: <20210726153830.613854294@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153828.144714469@linuxfoundation.org> References: <20210726153828.144714469@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
--- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -129,8 +129,10 @@ static int anon_release_pages(char *rel_ static void anon_allocate_area(void **alloc_area) { - if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) { - fprintf(stderr, "out of memory\n"); + *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + if (*alloc_area == MAP_FAILED) + fprintf(stderr, "mmap of anonymous memory failed"); *alloc_area = NULL; } }