Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp76164iob; Wed, 27 Apr 2022 19:34:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5NZ5Woei20+cCD8Nj4Qr115a4XMg8Ezc5cyVHmN7gS7imf2Dwk7KTvH14pgNLZH+wJHYl X-Received: by 2002:a17:907:6d2a:b0:6df:e513:5410 with SMTP id sa42-20020a1709076d2a00b006dfe5135410mr28824618ejc.544.1651113285464; Wed, 27 Apr 2022 19:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651113285; cv=none; d=google.com; s=arc-20160816; b=0yD7pd1LtUY6Q9o6T2ElSj06IqwFn2wPwMy4itN7PDEfTGrzvHDB7KdJAC/osMc7/D 772v7j/8TgCukJHToQThsgFYm6yVLvfybvCpMzjiF/nAyQt4T5X+inmKmlxJMj1v2ki7 px0xTd/Pz5q7H+XPDCqGwe5NmIQcsHXyJjrA6NvP63fkymddqrY0ghrcbczF0Q2aS2KR P6MmPuptmpT4IEuXDjlfiJFBFaaLHvKAuImzeagyZIUgErEty3AD6R1t541xJ+Xrj18u NmM3XtTVnu27Fp6qoG/GoSmuqRx4cVjxTrNkHedjLEu3XwdxPCrlY7XM5B0iAvzStuwL J3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hDNmZdaTEeDFa+SYiy2FhMpx+6VvsSpHDLR10ll6ANk=; b=SPaKe7f/9w2cDAVMz1muDJq6SseM0IWgxhScAVZ7zQZxVOv8M9VKSyzCqJZYpiPGI7 vOzP/44EAM4xJbeGszXxiRzfsRmJiQnlphWqdmgn1iZj9U9hL4ZDV/2DtevJoEtG9qrM DQW4LU9u7n4gRr7DjM5FTRWoXa6n5XpiHUJXLNpvPOE7/593b457pKg2kLPlHicfhCMd UAqZ90ddh2nt0Tx6ilCnIhZ/8Zc/9ISTKeAu9Ij05ma3dkiLJzXD4j8dYpPLdLfhTF+3 IjginQCc9QEL8h0jeb8iVLb7m5qz8o6kEXo8//05r3MjN7Wsl+8wOJLYseYFDGATmAjp Ze/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UMzpsSww; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fr29-20020a170906891d00b006efac6c0b7csi2518166ejc.7.2022.04.27.19.34.21; Wed, 27 Apr 2022 19:34:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UMzpsSww; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237710AbiD0Wtt (ORCPT + 99 others); Wed, 27 Apr 2022 18:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237074AbiD0Wto (ORCPT ); Wed, 27 Apr 2022 18:49:44 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517284339B for ; Wed, 27 Apr 2022 15:46:23 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id y3so6097649ejo.12 for ; Wed, 27 Apr 2022 15:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hDNmZdaTEeDFa+SYiy2FhMpx+6VvsSpHDLR10ll6ANk=; b=UMzpsSwwPouW1UdBJS7hpyHQxIRy9nsYXCcr9W+7hljC2F5PSqtNm+jQpv/doXqgu3 HHNb11Aqbv0E91en3I4gFKU/Ii3fTqFvtEZBSNF5NiNzxy7j5SmPrYkyEuZJEcgk+vHR ZBYuesRRia/y2TI4iP0yu4jutPxojq52zbsFu2RdahZURM8L2tUCeQzAxKnM83oJ703S XUBGD5Uv6V3JfnkZAjpopKPf+H6oN1OCemBpy3EBanwiEmr7AqU8d74HMf1j0Q6bg1NO TqQ6GfwQPXaSRTzatjK+ukk+PboYm1k7ZbL+p3l8tZoxaVsNYsQRJdofW2p1p6w8K24i 05qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hDNmZdaTEeDFa+SYiy2FhMpx+6VvsSpHDLR10ll6ANk=; b=Gwd9uAfZ0TiDNcfyg1IFB0ZX7hoCzd75JmA33eLPkE2+8QzNAjgvtxo3N/VAqJ7Io2 tiv++FpOawJhArc7qJsds2BWT0diWCVrJi+EZnNv5mRGPW7nn4BDkqeQNr1KL6VvIYwE TGaPfpkoK2ILF9LAkULhm/C3dKYLvq7Axar+J0p1yfangAXXVRarWk5zbY4Bp7oDVLB1 QgaNvie2v5bjyQ9OqndHkpaE3zEVvQrdd43JsTMGfC6SVLHMKBy9/KtydDnbJkYUIw4I bxtCbOlo3YJXNtWvQ5PYkH/UYcWdKZw5NYGmSAA00OtPi9hiqjdGWEiK+nYnpU8IxzAW Q/Gw== X-Gm-Message-State: AOAM531kz8YWi9chhnR/NkZK/8AGDd9LE58Z17LDGj+wJVedsouffmlF x//KQIA7iK4iZaEqP06O3Gw= X-Received: by 2002:a17:907:d24:b0:6f3:7c4f:f710 with SMTP id gn36-20020a1709070d2400b006f37c4ff710mr21160019ejc.6.1651099581835; Wed, 27 Apr 2022 15:46:21 -0700 (PDT) Received: from nlaptop.localdomain (ptr-dtfv0poj8u7zblqwbt6.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:eef0:f2b6:6987:9238:41ca]) by smtp.gmail.com with ESMTPSA id o14-20020a170906774e00b006d5b915f27dsm7351657ejn.169.2022.04.27.15.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 15:46:21 -0700 (PDT) From: Niels Dossche To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mina Almasry , Niels Dossche Subject: [PATCH 1/2] mm: mremap: fix sign for EFAULT error return value Date: Thu, 28 Apr 2022 00:44:38 +0200 Message-Id: <20220427224439.23828-2-dossche.niels@gmail.com> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220427224439.23828-1-dossche.niels@gmail.com> References: <20220427224439.23828-1-dossche.niels@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mremap syscall is supposed to return a pointer to the new virtual memory area on success, and a negative value of the error code in case of failure. Currently, EFAULT is returned when the VMA is not found, instead of -EFAULT. The users of this syscall will therefore believe the syscall succeeded in case the VMA didn't exist, as it returns a pointer to address 0xe (0xe being the value of EFAULT). Fix the sign of the error value. Fixes: 550a7d60bd5e ("mm, hugepages: add mremap() support for hugepage backed vma") Signed-off-by: Niels Dossche --- mm/mremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mremap.c b/mm/mremap.c index 303d3290b938..0b93fac76851 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -947,7 +947,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, return -EINTR; vma = vma_lookup(mm, addr); if (!vma) { - ret = EFAULT; + ret = -EFAULT; goto out; } -- 2.35.2