Skip to content

Commit

Permalink
prov/usnic: fix CID 375177
Browse files Browse the repository at this point in the history
Ensure order of operations doesn't truncate a value: force the use of
64-bit math.

Signed-off-by: Jeff Squyres <[email protected]>
  • Loading branch information
jsquyres authored and j-xiong committed Apr 18, 2024
1 parent a466f1b commit ee31a23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion prov/usnic/src/usnic_direct/usd_queues.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ usd_create_wq_pio(
/* packet buffer */
wq->pio_v_pkt_buf = (void *)ivaddr;
wq->pio_p_pkt_buf = pio_paddr + ivaddr - (uint64_t)pio_vaddr;
ivaddr += wq->uwq_num_entries * 256;
ivaddr += ((uint64_t) wq->uwq_num_entries) * 256;

used_size = ivaddr - (uintptr_t)pio_vaddr;
if (used_size > pio_memsize) {
Expand Down

0 comments on commit ee31a23

Please sign in to comment.