From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSqNA-0001jL-0k for qemu-devel@nongnu.org; Tue, 12 Jun 2018 16:58:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSqN5-0001pE-7d for qemu-devel@nongnu.org; Tue, 12 Jun 2018 16:58:36 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:42177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSqN5-0001p6-1C for qemu-devel@nongnu.org; Tue, 12 Jun 2018 16:58:31 -0400 Received: by mail-pl0-x241.google.com with SMTP id w17-v6so170826pll.9 for ; Tue, 12 Jun 2018 13:58:30 -0700 (PDT) References: <20180611171007.4165-1-peter.maydell@linaro.org> <20180611171007.4165-3-peter.maydell@linaro.org> From: Richard Henderson Message-ID: Date: Tue, 12 Jun 2018 10:58:26 -1000 MIME-Version: 1.0 In-Reply-To: <20180611171007.4165-3-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] exec.c: Don't accidentally sign-extend 4-byte loads in subpage_read() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , patches@linaro.org On 06/11/2018 07:10 AM, Peter Maydell wrote: > In subpage_read() we perform a load of the data into a local buffer > which we then access using ldub_p(), lduw_p(), ldl_p() or ldq_p() > depending on its size, storing the result into the uint64_t *data. > Since ldl_p() returns an 'int', this means that for the 4-byte > case we will sign-extend the data, whereas for 1 and 2 byte > reads we zero-extend it. > > This ought not to matter since the caller will likely ignore values in > the high bytes of the data, but add a cast so that we're consistent. > > Signed-off-by: Peter Maydell > --- Reviewed-by: Richard Henderson r~