From nobody Sun Feb 8 23:59:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1665079558; cv=none; d=zohomail.com; s=zohoarc; b=BHrd+cLThfvcLSR8PDhLSEEk4nrjmXGsYhHF+xoN+e0okfVmOaAmvsBgL/AAGqeQuYi2P0jxhGYGIGTTFhP9F9mSltdq1p7IHbzfcHxVzVp30CESEAiU0VEBno9PuJRPbfWxEQjTjr6hUST4tyiU9HMQWgspTYqNsp7Vvc74rZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665079558; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject; bh=L7fO1egp6CmiWhizzOTuOFeAvjN+DJZNJ5nac0rUuN4=; b=XH4DQVXNjj/7GIhNrKdXCXDukWMYAzK/TjwGR+XBDMoovcjh3pBCdEpYB9PQWcr0BXo0WCqhzd8jZ6yDmLbn/zz1Cq7vqQwsXMmMsS+uY/Kwq/r4beaNWFoWEWgUe2Z2QevpugLGwFMn7lKGXM7LD/IPGWfXV9tGP8/qYbnR9jU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665079558578535.5625311722787; Thu, 6 Oct 2022 11:05:58 -0700 (PDT) Received: from localhost ([::1]:57680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogVFs-0008S2-63 for importer@patchew.org; Thu, 06 Oct 2022 14:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogTyt-0006Fu-5M for qemu-devel@nongnu.org; Thu, 06 Oct 2022 12:44:19 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:34370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogTyp-0002an-RJ for qemu-devel@nongnu.org; Thu, 06 Oct 2022 12:44:18 -0400 Received: by mail-pf1-x436.google.com with SMTP id f140so2578420pfa.1 for ; Thu, 06 Oct 2022 09:44:14 -0700 (PDT) Received: from DESKTOP-8TCEJFK.localdomain (215.134.178.217.shared.user.transix.jp. [217.178.134.215]) by smtp.gmail.com with ESMTPSA id m11-20020a170902db0b00b0016c09a0ef87sm1480547plx.255.2022.10.06.09.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 09:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isshiki-clinic-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=L7fO1egp6CmiWhizzOTuOFeAvjN+DJZNJ5nac0rUuN4=; b=mqLSA0dKC83dW5y9gAINZ5lrTawA43FlLPfsI/c/l+Zmm9E8WRnu86mriOKUfKDc1y VdzWp6zhFZXxM3VbQ8cZTw7hkyfIy7yyzSEv9HMz+HqtXeTdDLgapt+Xb5oSXCXhtUZM hrck1jttTk21lAlAfRZwvRhK7v9XdXc8veXLKRJQfXSY43w2iBHMo8ym1iBKR/861WWP BU8PxnjJ/DVdAfql5iDQTEW3OslrHFuxeayJC61ym2TJWX/wp41yyAtzoDTGXlPvDZLi jFAFHajcUaOddXa8dWBd1RgqhnlzIdp5qAFhV+pysd9i/6qUG2i91N+RgRewIgJwOBzu Pyxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=L7fO1egp6CmiWhizzOTuOFeAvjN+DJZNJ5nac0rUuN4=; b=8QiUZMds6oDTkqjgq41KzvdC4jN8BEcld6bTQp0IOLBjuP6Cl3EF9dVmAXf4aM0vud L+Dw+1lFDX63gmVsRyy55oubXnKMR44kcB+dTz6+3HgTcu51KDOozcpqB5rb+9ACEeBG vOME7VnsMQeGNk+rWcvDR/Hwha82f02u8z7CmbHui8ZJpJJJ8XxoOIqcEX+9Dx6dIrZv LJQk7zldZCH+t6PxHlpHfstPBhUJnNGzcBzIRNI9DFKryYafi2laWae2Y+47eECO19xI HHjHNn8KsqWwxD3u3upPuAeNR5LANoXhlymzuL8JZBiQx5IRAw6ptUyPE41t8OSsLv7I LQpA== X-Gm-Message-State: ACrzQf0yH5iNX7jrOe+cSOzYDrLDN9IhRctsxoSJIZIF8GOmThqGi5S2 kz01eHFhFi0p8m5nJI7ZeuVZsQ== X-Google-Smtp-Source: AMsMyM5I6d97Q2anQ9Bn7bUp3B3QRYX45/i9l+DlUCWnhuZxHKFtTzKiILkgro6yCK3x4KicTB7CeQ== X-Received: by 2002:a65:6e9a:0:b0:44c:2476:12e0 with SMTP id bm26-20020a656e9a000000b0044c247612e0mr632177pgb.159.1665074653858; Thu, 06 Oct 2022 09:44:13 -0700 (PDT) From: Soichiro Isshiki X-Google-Original-From: Soichiro Isshiki To: Cc: sisshiki1969 , Laurent Vivier , qemu-devel@nongnu.org (open list:All patches CC here) Subject: [PATCH] linux-user: mprotect() should returns 0 when len is 0. Date: Fri, 7 Oct 2022 01:43:43 +0900 Message-Id: <20221006164343.23693-1-sisshiki@mac.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::436; envelope-from=sisshiki@isshiki-clinic.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 06 Oct 2022 13:02:44 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @isshiki-clinic-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1665079562832100001 Content-Type: text/plain; charset="utf-8" From: sisshiki1969 Signed-off-by: sisshiki1969 --- linux-user/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 28f3bc85ed..1ed79459ea 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -130,12 +130,12 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt target_prot) } len =3D TARGET_PAGE_ALIGN(len); end =3D start + len; - if (!guest_range_valid_untagged(start, len)) { - return -TARGET_ENOMEM; - } if (len =3D=3D 0) { return 0; } + if (!guest_range_valid_untagged(start, len)) { + return -TARGET_ENOMEM; + } =20 mmap_lock(); host_start =3D start & qemu_host_page_mask; --=20 2.25.1