Skip to content

Commit

Permalink
Fixed ffi_call return code type which was causing stack smashing error (
Browse files Browse the repository at this point in the history
Xilinx#6959)

* Fixed ffi_call return code type which was causing stack smashing error

* Updated kernel_return conversion

* refactor based on PR comment

Co-authored-by: Jeff Lin <[email protected]>
  • Loading branch information
jeffli-xilinx and Jeff Lin authored Sep 23, 2022
1 parent c3a48cc commit 69e5f32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime_src/core/edge/skd/xrt_skd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace xrt {
XCL_DRIVER_DLLESPEC
void
skd::run() {
int32_t kernel_return = 0;
ffi_sarg kernel_return = 0;
int ret = 0;
void* ffi_arg_values[num_args];
// Buffer Objects
Expand Down Expand Up @@ -221,7 +221,7 @@ namespace xrt {
}

ffi_call(&cif,FFI_FN(kernel), &kernel_return, ffi_arg_values);
args_from_host[return_offset] = (uint32_t)kernel_return;
args_from_host[return_offset] = (kernel_return >= 0) ? static_cast<uint32_t>(kernel_return) : 255; // Exit status out of range if returning negative value

// Unmap Buffers
for(auto i:bo_list) {
Expand Down

0 comments on commit 69e5f32

Please sign in to comment.