commit | b47475a4394f957cb84b43788bd87617ab5940ae | [log] [tgz] |
---|---|---|
author | Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com> | Thu Sep 29 15:33:50 2022 +0530 |
committer | Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com> | Tue Oct 11 21:17:47 2022 +0530 |
tree | 6f29a48e31675efb419783ae73ef86797f846f30 | |
parent | 01772536efdbd00c22b6734ec080cabea3ae3dc5 [diff] |
fix(gicv3/multichip): fix overflow caused by left shift When spi_id_max is 5119, the expression `(spi_id_max - 4096U + 1U >> 5)` evaluates to 32 leading to undefined behavior when using it to left shift 1. Fix this undefined behavior. Reported-by coverity scan: https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.org/thread/RMB4U7COL6IONZWEGF2FWXOQ6FPDIT4U/ ``` large_shift: In expression 1 << (spi_id_max - 4096U + 1U >> 5), left shifting by more than 31 bits has undefined behavior. The shift amount, spi_id_max - 4096U + 1U >> 5, is as much as 32. ``` Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com> Change-Id: I5e77a78b81a6d0367875e7ea432a82b6ba0e587c