Received: from eggs.gnu.org ([2001:4830:134:3::10]:46133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHqmh-0004Fz-2g for qemu-devel@nongnu.org; Wed, 31 Oct 2018 09:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHqmc-0005PN-J2 for qemu-devel@nongnu.org; Wed, 31 Oct 2018 09:43:46 -0400 References: <20181030170353.7447-1-peter.maydell@linaro.org> From: Laurent Vivier Message-ID: Date: Wed, 31 Oct 2018 14:43:34 +0100 MIME-Version: 1.0 In-Reply-To: <20181030170353.7447-1-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH for-3.1] hw/ppc/ppc440_uc: Remove dead code in sdram_size() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: BALATON Zoltan , qemu-ppc@nongnu.org, David Gibson On 30/10/2018 18:03, Peter Maydell wrote: > Coverity points out in CID 1390588 that the test for sh == 0 > in sdram_size() can never fire, because we calculate sh with > sh = 1024 - ((bcr >> 6) & 0x3ff); > which must result in a value between 1 and 1024 inclusive. > > Without the relevant manual for the SoC, we're not completely > sure of the correct behaviour here, but we can remove the > dead code without changing how QEMU currently behaves. > > Signed-off-by: Peter Maydell > --- > We had a discussion about this coverity error a while back: > https://lists.nongnu.org/archive/html/qemu-devel/2018-04/msg05187.html > I'd just like to squash the Coverity warning, I think. > > hw/ppc/ppc440_uc.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c > index 09ccda548f3..9360f781cef 100644 > --- a/hw/ppc/ppc440_uc.c > +++ b/hw/ppc/ppc440_uc.c > @@ -559,11 +559,7 @@ static target_ulong sdram_size(uint32_t bcr) > int sh; > > sh = 1024 - ((bcr >> 6) & 0x3ff); > - if (sh == 0) { > - size = -1; > - } else { > - size = 8 * MiB * sh; > - } > + size = 8 * MiB * sh; > > return size; > } > Reviewed-by: Laurent Vivier