Skip to content

Commit 7e64b65

Browse files
committed
init dma mrpc output buffer to 0xff
In dma mrpc case, FW just push the valid length of data to the dma buffer, which will lead to uninitialized data after the valid data copy to userspace.
1 parent da90f86 commit 7e64b65

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

switchtec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static void mrpc_cmd_submit(struct switchtec_dev *stdev)
143143

144144
if (stdev->dma_mrpc) {
145145
stdev->dma_mrpc->status = SWITCHTEC_MRPC_STATUS_INPROGRESS;
146+
memset(stdev->dma_mrpc->data, 0xFF, SWITCHTEC_MRPC_PAYLOAD_SIZE);
146147
}
147148

148149
stuser_set_state(stuser, MRPC_RUNNING);

0 commit comments

Comments
 (0)