提交 b4e964f8 编写于 作者: C Colin Ian King 提交者: Greg Kroah-Hartman

habanalabs/gaudi: Fix uninitialized return code rc when read size is zero

In the case where size is zero the while loop never assigns rc and the
return value is uninitialized. Fix this by initializing rc to zero.

Fixes: 639781dc ("habanalabs/gaudi: add debugfs to DMA from the device")
Reviewed-by: NOded Gabbay <ogabbay@kernel.org>
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Uninitialized scalar variable")
Link: https://lore.kernel.org/r/20210412161012.1628202-1-colin.king@canonical.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 39d2a789
......@@ -6252,7 +6252,7 @@ static int gaudi_debugfs_read_dma(struct hl_device *hdev, u64 addr, u32 size,
dma_addr_t dma_addr;
void *kernel_addr;
bool is_eng_idle;
int rc, dma_id;
int rc = 0, dma_id;
kernel_addr = hdev->asic_funcs->asic_dma_alloc_coherent(
hdev, SZ_2M,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册