kernel: port: check USE_USER_COPY flag before masking it.

writev_port_etc() used memcpy() instead of user_memcpy() for user buffers.
The branch was even left out silently as an optimization on gcc5.
This commit is contained in:
Jérôme Duval 2018-01-07 22:32:44 +01:00
parent da8f9c86bd
commit 6e28d80927
1 changed files with 2 additions and 2 deletions

View File

@ -1563,6 +1563,8 @@ writev_port_etc(port_id id, int32 msgCode, const iovec* msgVecs,
if (bufferSize > PORT_MAX_MESSAGE_SIZE)
return B_BAD_VALUE;
bool userCopy = (flags & PORT_FLAG_USE_USER_MEMCPY) != 0;
// mask irrelevant flags (for acquire_sem() usage)
flags &= B_CAN_INTERRUPT | B_KILL_CAN_INTERRUPT | B_RELATIVE_TIMEOUT
| B_ABSOLUTE_TIMEOUT;
@ -1574,8 +1576,6 @@ writev_port_etc(port_id id, int32 msgCode, const iovec* msgVecs,
timeout += system_time();
}
bool userCopy = (flags & PORT_FLAG_USE_USER_MEMCPY) > 0;
status_t status;
port_message* message = NULL;