qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/6] bsd-user/freebsd/os-syscall.c: lock_iovec


From: Richard Henderson
Subject: Re: [PATCH 1/6] bsd-user/freebsd/os-syscall.c: lock_iovec
Date: Tue, 7 Jun 2022 14:01:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 6/7/22 13:14, Warner Losh wrote:
+static void helper_unlock_iovec(struct target_iovec *target_vec,
+                                abi_ulong target_addr, struct iovec *vec,
+                                int count, int copy)
+{
+    for (int i = 0; i < count; i++) {
+        abi_ulong base = tswapal(target_vec[i].iov_base);
+        abi_long len = tswapal(target_vec[i].iov_len);
+        if (len < 0) {
+            /*
+             * Can't really happen: we'll fail to lock if any elements have a
+             * length < 0. Better to fail-safe though.
+             */
+            break;
+        }

I think this is over-complicated, could be fixed by...

+    vec = g_try_new(struct iovec, count);

... using g_try_new0.

+    /*
+     * ??? If host page size > target page size, this will result in a value
+     * larger than what we can actually support.
+     * ??? Should we just assert something for new 16k page size on aarch64?
+     */
+    max_len = 0x7fffffff & TARGET_PAGE_MASK;

Use minimum value, I think.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]