Message ID | 20200831134318.11443-1-yung-chuan.liao@linux.intel.com (mailing list archive) |
---|---|
Headers | show |
Series | ASoC: soundwire: fix port_ready[] dynamic allocation | expand |
On 31-08-20, 21:43, Bard Liao wrote: > The existing code allocates memory for the total number of ports. > This only works if the ports are contiguous, but will break if e.g. a > Devices uses port0, 1, and 14. The port_ready[] array would contain 3 > elements, which would lead to an out-of-bounds access. Conversely in > other cases, the wrong port index would be used leading to timeouts on > prepare. > > This can be fixed by allocating for the worst-case of 15 > ports (DP0..DP14). In addition since the number is now fixed, we can > use an array instead of a dynamic allocation. Applied all, thanks