From nobody Tue Feb 10 22:17:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528765608062243.25392814266638; Mon, 11 Jun 2018 18:06:48 -0700 (PDT) Received: from localhost ([::1]:52088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSXln-0007gO-Ap for importer@patchew.org; Mon, 11 Jun 2018 21:06:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSXXm-0005D9-Mp for qemu-devel@nongnu.org; Mon, 11 Jun 2018 20:52:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSXXl-0007a5-Ff for qemu-devel@nongnu.org; Mon, 11 Jun 2018 20:52:18 -0400 Received: from mail-pg0-x230.google.com ([2607:f8b0:400e:c05::230]:46959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSXXl-0007ZO-8O for qemu-devel@nongnu.org; Mon, 11 Jun 2018 20:52:17 -0400 Received: by mail-pg0-x230.google.com with SMTP id d2-v6so10588635pga.13 for ; Mon, 11 Jun 2018 17:52:17 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id l26-v6sm43362802pgn.55.2018.06.11.17.52.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 17:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w3OhhwzXmiCocExQ6RAX8gk5UKnmzB9QSB7Nc++/r+4=; b=V4u3tlmvn1uHbCFZOp1oASrdPEg4hVfEOKEuO8yiO/gk5S2cUM+N1fW/KGigggHvpL f0WwxpzTj4JcF+wah8h/iqMUWPC0LaS32lYJODk+gymcal0G3G7Opp5xx9q6f9a/eG2W KDGmna6zA7TpFqNK5L0H4PY4JSif5h0QUHFMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w3OhhwzXmiCocExQ6RAX8gk5UKnmzB9QSB7Nc++/r+4=; b=YDrJKyLwAX6O1//TqAROzmIwx7lWEkcCWo8MKIGAvCuf719nT/gVGYC6e5206OAzJa GQzH+oY3gyZM/Zzd4YU3Y3ayU9xi4KeasDF6UnnVs3D+99YWAKX+BZZWUyd9L/gNm9D6 XTWYyMJxYhOInE9UbVWA83esVbHiyljWdXiaQTgYqZpCgid3/8nk8qOMNE9nuCboRi+A aQxGwvjg1LgpCbCbJV6qSBoUON9fC8a1XmAM+L7obyOhXK+Wl0+KYwBqu7FPDbQvpY41 sY6a7rRButd97L0oUR+I5f/Yfx3/bST1C3HBAQWSyXL1reSmGxfRqnTXbV4q4YsOHERh Y5WQ== X-Gm-Message-State: APt69E2KslPipBY5Z0EPw1S9JE7St8/EGVJjZlvUYfwixRB3PAYcXpEg nRv9kVrF2qW7bPf3eZZnhu8nF2wSimw= X-Google-Smtp-Source: ADUXVKI595Be3oOLqBh8hmH1FUtJo+Sl8CN71biZfS4S5fO0b44VpWUfcM0IPJq1VHlq8hS/gXegnQ== X-Received: by 2002:a65:611a:: with SMTP id z26-v6mr1191467pgu.61.1528764735822; Mon, 11 Jun 2018 17:52:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 11 Jun 2018 14:51:37 -1000 Message-Id: <20180612005145.3375-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612005145.3375-1-richard.henderson@linaro.org> References: <20180612005145.3375-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::230 Subject: [Qemu-devel] [PATCH v3 11/19] linux-user: Propagate goto fail to return X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- linux-user/syscall.c | 60 ++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5a17803732..fd8d48b0da 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8865,8 +8865,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, how =3D SIG_SETMASK; break; default: - ret =3D -TARGET_EINVAL; - goto fail; + return -TARGET_EINVAL; } mask =3D arg2; target_to_host_old_sigset(&set, &mask); @@ -8893,8 +8892,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, how =3D SIG_SETMASK; break; default: - ret =3D -TARGET_EINVAL; - goto fail; + return -TARGET_EINVAL; } if (!(p =3D lock_user(VERIFY_READ, arg2, sizeof(target_sig= set_t), 1))) return -TARGET_EFAULT; @@ -8937,8 +8935,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, how =3D SIG_SETMASK; break; default: - ret =3D -TARGET_EINVAL; - goto fail; + return -TARGET_EINVAL; } if (!(p =3D lock_user(VERIFY_READ, arg2, sizeof(target_sig= set_t), 1))) return -TARGET_EFAULT; @@ -9227,15 +9224,15 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, =20 ret =3D copy_from_user_fdset_ptr(&rfds, &rfds_ptr, rfd_addr, n= ); if (ret) { - goto fail; + return ret; } ret =3D copy_from_user_fdset_ptr(&wfds, &wfds_ptr, wfd_addr, n= ); if (ret) { - goto fail; + return ret; } ret =3D copy_from_user_fdset_ptr(&efds, &efds_ptr, efd_addr, n= ); if (ret) { - goto fail; + return ret; } =20 /* @@ -9268,8 +9265,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, sig.set =3D &set; if (arg_sigsize !=3D sizeof(*target_sigset)) { /* Like the kernel, we enforce correct size sigset= s */ - ret =3D -TARGET_EINVAL; - goto fail; + return -TARGET_EINVAL; } target_sigset =3D lock_user(VERIFY_READ, arg_sigset, sizeof(*target_sigset), 1); @@ -9700,17 +9696,15 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, case TARGET_SYSLOG_ACTION_READ_CLEAR: /* Read/clear msgs */ case TARGET_SYSLOG_ACTION_READ_ALL: /* Read last messages= */ { - ret =3D -TARGET_EINVAL; if (len < 0) { - goto fail; + return -TARGET_EINVAL; } if (len =3D=3D 0) { return 0; } p =3D lock_user(VERIFY_WRITE, arg2, arg3, 0); if (!p) { - ret =3D -TARGET_EFAULT; - goto fail; + return -TARGET_EFAULT; } ret =3D get_errno(sys_syslog((int)arg1, p, (int)arg3)); unlock_user(p, arg2, arg3); @@ -10056,8 +10050,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, =20 dirp =3D g_try_malloc(count); if (!dirp) { - ret =3D -TARGET_ENOMEM; - goto fail; + return -TARGET_ENOMEM; } =20 ret =3D get_errno(sys_getdents(arg1, dirp, count)); @@ -10456,7 +10449,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, arg2 ? &node : NULL, NULL)); if (is_error(ret)) { - goto fail; + return ret; } if (arg1 && put_user_u32(cpu, arg1)) { return -TARGET_EFAULT; @@ -10903,8 +10896,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, grouplist =3D alloca(gidsetsize * sizeof(gid_t)); target_grouplist =3D lock_user(VERIFY_READ, arg2, gidsetsi= ze * sizeof(target_id), 1); if (!target_grouplist) { - ret =3D -TARGET_EFAULT; - goto fail; + return -TARGET_EFAULT; } for (i =3D 0; i < gidsetsize; i++) { grouplist[i] =3D low2highgid(tswapid(target_grouplist[= i])); @@ -11162,8 +11154,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, how =3D SIG_SETMASK; break; default: - ret =3D -TARGET_EINVAL; - goto fail; + return -TARGET_EINVAL; } mask =3D arg2; target_to_host_old_sigset(&set, &mask); @@ -11211,8 +11202,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, if (!is_error(ret)) { target_grouplist =3D lock_user(VERIFY_WRITE, arg2, gidsets= ize * 4, 0); if (!target_grouplist) { - ret =3D -TARGET_EFAULT; - goto fail; + return -TARGET_EFAULT; } for(i =3D 0;i < ret; i++) target_grouplist[i] =3D tswap32(grouplist[i]); @@ -11232,8 +11222,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, grouplist =3D alloca(gidsetsize * sizeof(gid_t)); target_grouplist =3D lock_user(VERIFY_READ, arg2, gidsetsize *= 4, 1); if (!target_grouplist) { - ret =3D -TARGET_EFAULT; - goto fail; + return -TARGET_EFAULT; } for(i =3D 0;i < gidsetsize; i++) grouplist[i] =3D tswap32(target_grouplist[i]); @@ -11308,20 +11297,17 @@ static abi_long do_syscall1(void *cpu_env, int nu= m, abi_long arg1, #ifdef TARGET_NR_mincore case TARGET_NR_mincore: { - void *a; - ret =3D -TARGET_ENOMEM; - a =3D lock_user(VERIFY_READ, arg1, arg2, 0); + void *a =3D lock_user(VERIFY_READ, arg1, arg2, 0); if (!a) { - goto fail; + return -TARGET_ENOMEM; } - ret =3D -TARGET_EFAULT; p =3D lock_user_string(arg3); if (!p) { - goto mincore_fail; + ret =3D -TARGET_EFAULT; + } else { + ret =3D get_errno(mincore(a, arg2, p)); + unlock_user(p, arg3, ret); } - ret =3D get_errno(mincore(a, arg2, p)); - unlock_user(p, arg3, ret); - mincore_fail: unlock_user(a, arg1, 0); } return ret; @@ -11787,8 +11773,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, ret =3D get_errno(sys_utimensat(arg1, NULL, tsp, arg4)); else { if (!(p =3D lock_user_string(arg2))) { - ret =3D -TARGET_EFAULT; - goto fail; + return -TARGET_EFAULT; } ret =3D get_errno(sys_utimensat(arg1, path(p), tsp, arg4)); unlock_user(p, arg2, 0); @@ -12424,7 +12409,6 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, gemu_log("qemu: Unsupported syscall: %d\n", num); return -TARGET_ENOSYS; } -fail: return ret; } =20 --=20 2.17.1