nvmecontrol: Fix a sign compare mismatch

Even though mqes (uint16_t) and queue_size (u_int) are both unsigned,
the expression 'mqes + 1' gets promoted to int which is signed.  Keep
the value unsigned by explicitly promoting mqes to u_int before
incrementing the value.

Reported by:	GCC
This commit is contained in:
John Baldwin 2024-05-07 13:45:51 -07:00
parent 766c4ad385
commit c8703409ed

View File

@ -452,8 +452,8 @@ connect_nvm_queues(const struct nvmf_association_params *aparams,
/* Validate I/O queue size. */
if (queue_size == 0)
queue_size = mqes + 1;
else if (queue_size > mqes + 1) {
queue_size = (u_int)mqes + 1;
else if (queue_size > (u_int)mqes + 1) {
shutdown_controller(*admin);
nvmf_free_association(na);
warn("I/O queue size exceeds controller maximum (%u)",