habanalabs: zero ts registration buff when allocated
authorfarah kassabri <fkassabri@habana.ai>
Tue, 20 Sep 2022 08:48:40 +0000 (11:48 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Wed, 23 Nov 2022 14:13:45 +0000 (16:13 +0200)
To avoid memory corruption in kernel memory while using timestamp
registration nodes, zero the kernel buff memory when its allocated.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/memory.c

index 99b1d6c..541e1b6 100644 (file)
@@ -2109,7 +2109,7 @@ static int hl_ts_alloc_buf(struct hl_mmap_mem_buf *buf, gfp_t gfp, void *args)
 
        /* Allocate the internal kernel buffer */
        size = num_elements * sizeof(struct hl_user_pending_interrupt);
-       p = vmalloc(size);
+       p = vzalloc(size);
        if (!p)
                goto free_user_buff;