opnsense-src/sys/dev/cxgbe/tom
John Baldwin b483b6b256 cxgbe tom: Force unsigned modulus for queue indices.
The final transmit and receive queue indices need to be positive
values.  However, since txq_idx and rxq_idx are signed (to permit
using -1 to as a marker for uninitialized values), using %= with
another integer type (vi->nofld[tr]xq) yielded a sign-extended modulus
value.  This resulted in negative queue indices and a buffer underrun
when arc4random() returned a value with the sign bit set.  Use a
temporary unsigned variable to hold the "raw" queue index to force
unsigned modulus.

This worked previously because the modulus was previously applied
directly to the return value of arc4random() which is unsigned before
the result was assigned to txq_idx and rxq_idx.

Discussed with:	np
Fixes:		db28d4a0cd cxgbe/t4_tom: Support for round-robin selection of offload queues.
Sponsored by:	Chelsio Communications
2022-05-05 16:30:14 -07:00
..
t4_connect.c cxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings. 2022-01-10 12:15:12 -08:00
t4_cpl_io.c cxgbe: plug a set-but-not-used var 2022-04-19 12:45:56 +00:00
t4_ddp.c cxgbei: Support unmapped I/O requests. 2022-03-10 15:50:52 -08:00
t4_listen.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
t4_tls.c ktls: Zero out TLS_GET_RECORD control messages 2022-01-20 15:42:46 -05:00
t4_tls.h cxgbe: De-duplicate some of the code for managing TLS key contexts. 2021-06-15 17:45:32 -07:00
t4_tom.c cxgbe tom: Force unsigned modulus for queue indices. 2022-05-05 16:30:14 -07:00
t4_tom.h cxgbei: Support unmapped I/O requests. 2022-03-10 15:50:52 -08:00
t4_tom_l2t.c cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution. 2021-09-08 20:55:47 -07:00
t4_tom_l2t.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00