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~