From patchwork Mon Jun 26 14:02:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 696446 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3245420wrm; Mon, 26 Jun 2023 07:03:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Kq8Kmw1wufaoPyFe/QMTvR8a9ZwSpQRIRzw1MZL064hgu1hlCy+uAk+6QizsRk4vRglnV X-Received: by 2002:a1f:dd02:0:b0:471:c1b1:bcb0 with SMTP id u2-20020a1fdd02000000b00471c1b1bcb0mr8775693vkg.3.1687788194909; Mon, 26 Jun 2023 07:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687788194; cv=none; d=google.com; s=arc-20160816; b=dsTx/bcqZlt81LLK+CRz6Ku+ik0CpxgP3L0xxRtnXg6LE/G7CyZ3Myajm/CWmJE2PH hLnCwJ1dh1Vk0LH3rZNnYaC98YdcTQYrM1X0uuZylIL4CiNIbfxzA/AAahZKkgjdOspC H29vBqeQCCQVArUz1GXqNcoKdNB+zV83fFmuaEcDF7TA8+84kdT/TU2lOgs7zufO62Ow WnjwYg2nubnjIw/zmi++L9xdm9LGCwYzh+ClE6XwVJL5p3IFUiHZim8Dzjh3YhzWsXS+ Io/cMMLkSsgVUTxtr77sDIndsJmYNYcD48WHkmBvyVZtImux5HLQlBlL8qQVJk0LQfGv jviQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=/Mw+q7U4ve19xzorCmqQmX4CCo2lwVfTBj0rm2i9dkM=; fh=w6mntY/IKsfZWJRLaWR2nDr5ntZXGuJsbDvRVbzUjLQ=; b=eoOrelIqaBhiNcUlzuaP95ysklLzVmDBB5R3N9qYPf0fT59KIRDsYRznX6nab4fi3E eRrsmkFIUKnbBiP6LbxABso+VJsp3y4nVSdEj+OY+Tt6CRPUYt1FZIjRixuDfUTSfEBy eHuKAbdxL3UpWN4PdMJ1BuSqurJQgvCGmIqbQ4oPYdDpetHI8NmTZLesCIF5b25OFccL eetZpnvMUAU/d4ckcoeDdKkHkEY+ocwV2hvahZY7wftZ6xdMOl/5Np/rXOeFBFHrqoxO IdF8u3rk0OitKI8BDe7vhDW6D9sodtREs1Aw/fu9JoOH/kb485C5ct074QuMZ2/kYn9y TDLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lkEpc8V3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w14-20020a05622a134e00b003f5aa8ecaddsi950058qtk.278.2023.06.26.07.03.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 07:03:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lkEpc8V3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDmnx-0008CM-2A; Mon, 26 Jun 2023 10:02:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDmnw-0008CD-0h for qemu-devel@nongnu.org; Mon, 26 Jun 2023 10:02:56 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDmnu-00006d-6g for qemu-devel@nongnu.org; Mon, 26 Jun 2023 10:02:55 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fa96fd79feso11876535e9.2 for ; Mon, 26 Jun 2023 07:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687788172; x=1690380172; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/Mw+q7U4ve19xzorCmqQmX4CCo2lwVfTBj0rm2i9dkM=; b=lkEpc8V34pbq2vfM54kkrsxheDRXSuB2W147JIibkriyEwut92XSJSRpp+VNqiARhX VTmkKsJEyMQCdgivbCHlSiGmJdyVe9wvFisMG1jGMcjYAbb83kYwhxVWpm04Qt1wNODc 9Uh7BTLWlrFlMbU9NttlVbQh2H7cYMVJoLZIPJ8JMyPGZIEvwkDPaWFeue3HlB/Mn/j9 ch7OYxjd+RN+VPX91KQ77OHesVN7zBeRraWhMU7rjT9SKLgW0BVFmdXxS9VG/3E92FE9 pNsWBE7yrujWq6n94YHoKlUO2Yu6NmbslmG1SF8Fl5zVt07RsA/tAoSqTPODIxD1HwZs Z9/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687788172; x=1690380172; 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=/Mw+q7U4ve19xzorCmqQmX4CCo2lwVfTBj0rm2i9dkM=; b=OTwAVY0WFzeUTbt5QPqpRIrgd+U1nJOG9XlBbEiQt6MwxaLRB18mnIxCp2V7tK/ohU YnsCwGIpcWxuSzEbRpRDHfIon9cSD6zxRA756BIA+iG4EpKwXGGFmO4RadRjr/pRJ98I ULY7NxAJEK9nIt5vOziFNMkMzF1ylDaGpJC+SS+0333Jyonvz0iFzWpnQ2ZTmVS3bE8X ZY0+aMcPku28R1LxbYK/Mc0YK3AaBt0zDFHDcg3gwuhFX0PwzjxhbKjnAMV3lHltNJME /z4kEMXrcC31CQ4IoUW8suRlWEqYbijWU2IZhwwmL48TCEHGApmrbuqjrkPR8e43mMKE pDCQ== X-Gm-Message-State: AC+VfDwAJGCRYpbo/ZeMb/ST70zr0ECFln/DYqPLslazUn/ijdXEbplP 8eFWqnLvoiaAkXAabg/N11VvVraNG23j7CVc4V0WcuSk X-Received: by 2002:a7b:c453:0:b0:3fa:7176:9590 with SMTP id l19-20020a7bc453000000b003fa71769590mr10283241wmi.38.1687788172498; Mon, 26 Jun 2023 07:02:52 -0700 (PDT) Received: from localhost.localdomain ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id i6-20020adffc06000000b00313e421c620sm6684822wrr.54.2023.06.26.07.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 07:02:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: anjo@rev.ng, laurent@vivier.eu Subject: [PATCH] linux-user: Fix do_shmat type errors Date: Mon, 26 Jun 2023 16:02:50 +0200 Message-Id: <20230626140250.69572-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The guest address, raddr, should be unsigned, aka abi_ulong. The host addresses should be cast via *intptr_t not long. Drop the inline and fix two other whitespace issues. Signed-off-by: Richard Henderson Reviewed-by: Anton Johansson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/syscall.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f2cb101d83..59b530547a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4528,14 +4528,14 @@ static inline abi_ulong target_shmlba(CPUArchState *cpu_env) } #endif -static inline abi_ulong do_shmat(CPUArchState *cpu_env, - int shmid, abi_ulong shmaddr, int shmflg) +static abi_ulong do_shmat(CPUArchState *cpu_env, int shmid, + abi_ulong shmaddr, int shmflg) { CPUState *cpu = env_cpu(cpu_env); - abi_long raddr; + abi_ulong raddr; void *host_raddr; struct shmid_ds shm_info; - int i,ret; + int i, ret; abi_ulong shmlba; /* shmat pointers are always untagged */ @@ -4591,9 +4591,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, if (host_raddr == (void *)-1) { mmap_unlock(); - return get_errno((long)host_raddr); + return get_errno((intptr_t)host_raddr); } - raddr=h2g((unsigned long)host_raddr); + raddr = h2g((uintptr_t)host_raddr); page_set_flags(raddr, raddr + shm_info.shm_segsz - 1, PAGE_VALID | PAGE_RESET | PAGE_READ | @@ -4610,7 +4610,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, mmap_unlock(); return raddr; - } static inline abi_long do_shmdt(abi_ulong shmaddr)