Skip to content

Conversation

@mingweishih
Copy link
Owner

Signed-off-by: Ming-Wei Shih mishih@microsoft.com

Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>
pargs_out->n[_i_1].array_of_int = NULL;
if (_rhs[_i_1].array_of_int)
{
int* _l_1_array_of_int =
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Own comment: use local variable to prevent the host from manipulating the memory used by the memcpy below. Note that the oe_host_malloc ensures that the return buffer resides on the host.

_rhs[_i_1].array_of_int,
((size_t)4 * sizeof(int)));
}
CountStruct* _l_1_array_of_struct = NULL;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

_l_1_array_of_struct[_i_2].ptr = NULL;
if (_rhs[_i_1].array_of_struct[_i_2].ptr)
{
uint64_t* _l_2_ptr = (uint64_t*)oe_host_malloc(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

{
int* _l_1_array_of_int =
(int*)oe_host_malloc(((size_t)4 * sizeof(int)));
pargs_out->n[_i_1].array_of_int = _l_1_array_of_int;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pargs_out->n[_i_1].array_of_int is under control by the host, but we won't use it directly other than this assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants