In the Linux kernel, the following vulnerability has been resolved:
dmaengine: zynqmpdma: In struct zynqmpdmachan fix descsize data type
In zynqmpdmaalloc/freechanresources functions there is a potential overflow in the below expressions.
dmaalloccoherent(chan->dev, (2 * chan->descsize * ZYNQMPDMANUMDESCS), &chan->descpoolp, GFP_KERNEL);
dmafreecoherent(chan->dev,(2 * ZYNQMPDMADESCSIZE(chan) * ZYNQMPDMANUMDESCS), chan->descpoolv, chan->descpoolp);
The arguments descsize and ZYNQMPDMANUMDESCS were 32 bit. Though this overflow condition is not observed but it is a potential problem in the case of 32-bit multiplication. Hence fix it by changing the descsize data type to sizet.
In addition to coverity fix it also reuse ZYNQMPDMADESCSIZE macro in dmaalloc_coherent API argument.
Addresses-Coverity: Event overflowbeforewiden.