[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] util/cutils: Silent Coverity array overrun warning in freq_t
From: |
Peter Maydell |
Subject: |
Re: [PATCH] util/cutils: Silent Coverity array overrun warning in freq_to_str() |
Date: |
Thu, 29 Oct 2020 19:16:35 +0000 |
On Thu, 29 Oct 2020 at 19:13, Peter Maydell <peter.maydell@linaro.org> wrote:
> We should either consistently assume that idx can never
> get to 7 (ie don't check it in the while loop condition
> because that test can never return true) or we should
> consistently guard against it happening (by switching the
> while loop to "<=", or by handling the idx==ARRAY_SIZE(suffixes)
> case specially.)
Oops; "switching to <=" isn't the right thing; you'd need to switch
to "< ARRAY_SIZE(suffixes) - 1". Anyway I think we should
do the other of the two options, not this one.
-- PMM