diff options
author | Oded Gabbay <oded.gabbay@gmail.com> | 2019-02-24 11:55:26 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-26 12:44:25 +0100 |
commit | e99f1683bbce050dd19f988d1f5490aea75417a4 (patch) | |
tree | fc8e4572e563be60242ee0b101fac3984a6ef7fd /drivers/misc/habanalabs/goya/goya.c | |
parent | b5958faa34e2f99f3475ad89c52d98dfea079d33 (diff) | |
download | lwn-e99f1683bbce050dd19f988d1f5490aea75417a4.tar.gz lwn-e99f1683bbce050dd19f988d1f5490aea75417a4.zip |
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: kbuild test robot <lkp@intel.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/habanalabs/goya/goya.c')
-rw-r--r-- | drivers/misc/habanalabs/goya/goya.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c index e6f0d49ab71a..fc53cdb38f23 100644 --- a/drivers/misc/habanalabs/goya/goya.c +++ b/drivers/misc/habanalabs/goya/goya.c @@ -3474,7 +3474,8 @@ u32 goya_get_dma_desc_list_size(struct hl_device *hdev, struct sg_table *sgt) { 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_desc_cnt = 0; @@ -3915,7 +3916,8 @@ static int goya_patch_dma_packet(struct hl_device *hdev, { struct hl_userptr *userptr; 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; enum goya_dma_direction user_dir; u64 device_memory_addr, addr; |