Commit e99f1683 authored by Oded Gabbay's avatar Oded Gabbay Committed by Greg Kroah-Hartman

habanalabs: use u64 when comparing variables' sum to u32_max

This patch fixes two smatch warnings about two if statements that are
always true because of the types of the variables used - u32 when
comparing the sum to u32_max.

The patch changes the types to be u64 so the accumalted sum can be checked
if it is larger than u32_max
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b5958faa
...@@ -3474,7 +3474,8 @@ u32 goya_get_dma_desc_list_size(struct hl_device *hdev, ...@@ -3474,7 +3474,8 @@ u32 goya_get_dma_desc_list_size(struct hl_device *hdev,
struct sg_table *sgt) struct sg_table *sgt)
{ {
struct scatterlist *sg, *sg_next_iter; struct scatterlist *sg, *sg_next_iter;
u32 count, len, dma_desc_cnt, len_next; u32 count, dma_desc_cnt;
u64 len, len_next;
dma_addr_t addr, addr_next; dma_addr_t addr, addr_next;
dma_desc_cnt = 0; dma_desc_cnt = 0;
...@@ -3915,7 +3916,8 @@ static int goya_patch_dma_packet(struct hl_device *hdev, ...@@ -3915,7 +3916,8 @@ static int goya_patch_dma_packet(struct hl_device *hdev,
{ {
struct hl_userptr *userptr; struct hl_userptr *userptr;
struct scatterlist *sg, *sg_next_iter; struct scatterlist *sg, *sg_next_iter;
u32 count, len, dma_desc_cnt, len_next; u32 count, dma_desc_cnt;
u64 len, len_next;
dma_addr_t dma_addr, dma_addr_next; dma_addr_t dma_addr, dma_addr_next;
enum goya_dma_direction user_dir; enum goya_dma_direction user_dir;
u64 device_memory_addr, addr; u64 device_memory_addr, addr;
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
#define VA_DDR_SPACE_SIZE (VA_DDR_SPACE_END - \ #define VA_DDR_SPACE_SIZE (VA_DDR_SPACE_END - \
VA_DDR_SPACE_START) /* 128GB */ VA_DDR_SPACE_START) /* 128GB */
#define DMA_MAX_TRANSFER_SIZE 0xFFFFFFFF #define DMA_MAX_TRANSFER_SIZE U32_MAX
#define HW_CAP_PLL 0x00000001 #define HW_CAP_PLL 0x00000001
#define HW_CAP_DDR_0 0x00000002 #define HW_CAP_DDR_0 0x00000002
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment