OSDN Git Service

accel/tcg: Assert mmu_idx in range before use in cputlb
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 1 Apr 2022 17:08:13 +0000 (11:08 -0600)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Apr 2022 02:57:56 +0000 (19:57 -0700)
commitb826044fc0c21d90a7fcfcf883cc8a8bf1bd7424
tree404b212cded67b5ff9745b92657ec4efdb83f91b
parenta72d9008092e39c2c37e47a91bae4e170d0f1b33
accel/tcg: Assert mmu_idx in range before use in cputlb

Coverity reports out-of-bound accesses within cputlb.c.
This should be a false positive due to how the index is
decoded from MemOpIdx.  To be fair, nothing is checking
the correct bounds during encoding either.

Assert index in range before use, both to catch user errors
and to pacify static analysis.

Fixes: Coverity CID 148712014871271487170148719614872151487238
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220401170813.318609-1-richard.henderson@linaro.org>
accel/tcg/cputlb.c