staging: emxx_udc question on i_write_length datatype
From: Deepak R Varma
Date: Thu Nov 03 2022 - 03:27:32 EST
Hello,
While reviewing this [1] coccicheck warning, I observed something that concerned
me. The variable i_write_length is declared to be of u32 type. Later it is
assigned a value DMA_MAX_COUNT * mpkt; which is 256 * u32;
I am unable to estimate if mpkt (or max packet size) can attain value greater
than 16777215 in which case the result will overflow the 32 bits of
i_write_length. Is it safe to make i_write_length to be a u64?
[1] drivers/staging/emxx_udc/emxx_udc.c:1007:28-29: WARNING opportunity for min()