habanalabs: initialize variable to default value
PATCH 1/2 habanalabs: initialize variable to default value
From: Tomer Tayar <[email protected]>
Fix the following smatch error in unmap_device_va():
error: uninitialized symbol 'rc'.
Signed-off-by Tomer Tayar <[email protected]>
Reviewed-by Oded Gabbay <[email protected]>
Signed-off-by Oded Gabbay <[email protected]>
--- drivers/misc/habanalabs/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/memory.c +1 -1
@@ -1023,7 +1023,7 @@ static int unmap_device_va(struct hl_ctx *ctx, u64 vaddr, bool ctx_free)struct hl_va_range *va_range;enum vm_type_t *vm_type;bool is_userptr; -int rc; +int rc =0 ;/* protect from double entrance */ mutex_lock (&ctx->mem_hash_lock);
Signature · 1 line
2.17.1
PATCH 2/2 habanalabs: correctly cast u64 to void*
Use the u64_to_user_ptr(x) kernel macro to correctly cast u64 to void*
Reported-by kbuild test robot <[email protected]>
Reviewed-by Omer Shpigelman <[email protected]>
Signed-off-by Oded Gabbay <[email protected]>
--- drivers/misc/habanalabs/command_submission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/command_submission.c +1 -1
@@ -789,7 +789,7 @@ static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type, size_to_copy = chunk->num_signal_seq_arr *sizeof (*signal_seq_arr);if (copy_from_user (signal_seq_arr, - (void __user *) chunk->signal_seq_arr, +u64_to_user_ptr (chunk->signal_seq_arr), size_to_copy)) {dev_err (hdev->dev,"Failed to copy signal seq array from user\n" );
Signature · 1 line
2.17.1