Skip to content

Commit 69a7486

Browse files
committed
ipc: Fix ipc_msg_send() with payload already prepared
If the msg->tx_size/data have been prepared by caller and it calls the function with NULL as data: ipc_msg_send(msg, NULL, false); then we try to copy from NULL to the msg->tx_data because msg->tx_data != data is true. The callers could be fixed as well, but the ipc_msg_send() should handle this. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent cfa5f02 commit 69a7486

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ipc/ipc-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority)
225225
key = k_spin_lock(&ipc->lock);
226226

227227
/* copy mailbox data to message if not already copied */
228-
if ((msg->tx_size > 0 && msg->tx_size <= SOF_IPC_MSG_MAX_SIZE) &&
228+
if (data && (msg->tx_size > 0 && msg->tx_size <= SOF_IPC_MSG_MAX_SIZE) &&
229229
msg->tx_data != data) {
230230
ret = memcpy_s(msg->tx_data, msg->tx_size, data, msg->tx_size);
231231
assert(!ret);

0 commit comments

Comments
 (0)