Commit 8742a75a authored by Oded Gabbay's avatar Oded Gabbay

habanalabs/gaudi: fix comment to reflect current code

Due to code changes in the past few years, the original comment of
how parser->user_cb_size is checked was not correct anymore.

Fix it to reflect current code and add more explanation as the code
is more complex now.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent d0c92afc
......@@ -5562,8 +5562,14 @@ static int gaudi_parse_cb_mmu(struct hl_device *hdev,
}
/*
* The check that parser->user_cb_size <= parser->user_cb->size was done
* in validate_queue_index().
* We are protected from overflow because the check
* "parser->user_cb_size <= parser->user_cb->size" was done in get_cb_from_cs_chunk()
* in the common code. That check is done only if is_kernel_allocated_cb is true.
*
* There is no option to reach here without going through that check because:
* 1. validate_queue_index() assigns true to is_kernel_allocated_cb for any submission to
* an external queue.
* 2. For Gaudi, we only parse CBs that were submitted to the external queues.
*/
memcpy(parser->patched_cb->kernel_address,
parser->user_cb->kernel_address,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment