From: Warner Losh <imp@bsdimp.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: qemu-devel@nongnu.org, Kyle Evans <kevans@freebsd.org>,
Laurent Vivier <laurent@vivier.eu>,
Pierrick Bouvier <pierrick.bouvier@linaro.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Weiwei Li <liwei1518@gmail.com>,
Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
qemu-riscv@nongnu.org
Subject: Re: [PATCH 1/3] bsd-user: Fix unlock_user API usage
Date: Fri, 20 Mar 2026 22:17:47 -0600 [thread overview]
Message-ID: <CANCZdfq+iybMORb=_zNCdmSGgFMc87FN_6njavohifLY_vpnkg@mail.gmail.com> (raw)
In-Reply-To: <20260321004836.500390-2-npiggin@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]
On Fri, Mar 20, 2026 at 6:49 PM Nicholas Piggin <npiggin@gmail.com> wrote:
> Fix errors in unlock_user() calls:
> - unlock_user() with len=1 instead of len=written
> - unlock_user() with len=1 instead of len=0
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> bsd-user/bsd-misc.c | 2 +-
> bsd-user/bsd-misc.h | 2 +-
> bsd-user/bsdload.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
Reviewed-by: Warner Losh <imp@bsdimp.com>
> diff --git a/bsd-user/bsd-misc.c b/bsd-user/bsd-misc.c
> index 3e1968718f..eac3edb8ac 100644
> --- a/bsd-user/bsd-misc.c
> +++ b/bsd-user/bsd-misc.c
> @@ -95,7 +95,7 @@ abi_long host_to_target_semarray(int semid, abi_ulong
> target_addr,
> for (i = 0; i < nsems; i++) {
> __put_user(array[i], host_array + i);
> }
> - unlock_user(array, target_addr, 1);
> + unlock_user(array, target_addr, nsems * sizeof(unsigned short));
> return 0;
> }
>
> diff --git a/bsd-user/bsd-misc.h b/bsd-user/bsd-misc.h
> index 13e40d9cde..13abc7e3b1 100644
> --- a/bsd-user/bsd-misc.h
> +++ b/bsd-user/bsd-misc.h
> @@ -211,7 +211,7 @@ static inline abi_long do_bsd___semctl(int semid, int
> semnum, int target_cmd,
> break;
> }
> out:
> - unlock_user(target_un, un_ptr, 1);
> + unlock_user(target_un, un_ptr, 0);
> return ret;
> }
>
> diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c
> index 5b3c061a45..9ea3b93825 100644
> --- a/bsd-user/bsdload.c
> +++ b/bsd-user/bsdload.c
> @@ -30,7 +30,7 @@ abi_long memcpy_to_target(abi_ulong dest, const void
> *src,
> return -TARGET_EFAULT;
> }
> memcpy(host_ptr, src, len);
> - unlock_user(host_ptr, dest, 1);
> + unlock_user(host_ptr, dest, len);
> return 0;
> }
>
> --
> 2.51.0
>
>
[-- Attachment #2: Type: text/html, Size: 2591 bytes --]
next prev parent reply other threads:[~2026-03-21 4:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 0:48 [PATCH 0/3] Fix missing and incorrect unlock_user calls Nicholas Piggin
2026-03-21 0:48 ` [PATCH 1/3] bsd-user: Fix unlock_user API usage Nicholas Piggin
2026-03-21 4:17 ` Warner Losh [this message]
2026-03-21 0:48 ` [PATCH 2/3] linux-user: " Nicholas Piggin
2026-03-22 6:54 ` Chao Liu
2026-03-26 6:01 ` Nicholas Piggin
2026-03-25 1:46 ` Alistair Francis
2026-03-26 6:20 ` Nicholas Piggin
2026-03-21 0:48 ` [PATCH 3/3] linux-user: riscv: Fix signal frame user mapping Nicholas Piggin
2026-03-22 6:44 ` Chao Liu
2026-03-25 1:53 ` Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANCZdfq+iybMORb=_zNCdmSGgFMc87FN_6njavohifLY_vpnkg@mail.gmail.com' \
--to=imp@bsdimp.com \
--cc=alistair.francis@wdc.com \
--cc=dbarboza@ventanamicro.com \
--cc=kevans@freebsd.org \
--cc=laurent@vivier.eu \
--cc=liwei1518@gmail.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox