From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn0iR-0003Vl-Jq for qemu-devel@nongnu.org; Fri, 16 Oct 2015 04:50:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zn0iQ-0006ua-Ae for qemu-devel@nongnu.org; Fri, 16 Oct 2015 04:50:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn0iQ-0006uM-5K for qemu-devel@nongnu.org; Fri, 16 Oct 2015 04:50:18 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C3B0FC0B64BE for ; Fri, 16 Oct 2015 08:50:17 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-80.ams2.redhat.com [10.36.112.80]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9G8oCaO010200 for ; Fri, 16 Oct 2015 04:50:17 -0400 From: Paolo Bonzini Date: Fri, 16 Oct 2015 10:49:25 +0200 Message-Id: <1444985411-17803-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1444985411-17803-1-git-send-email-pbonzini@redhat.com> References: <1444985411-17803-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 03/49] megasas: fix megasas_get_sata_addr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org There are two bugs here. First, the 16-bit id loses the high 8 bits when shifted left by 24. Second, the address must be combined with an "or" or we just get zero. Signed-off-by: Paolo Bonzini --- hw/scsi/megasas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index a04369c..dcd724e 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -431,7 +431,7 @@ static uint64_t megasas_fw_time(void) static uint64_t megasas_get_sata_addr(uint16_t id) { uint64_t addr = (0x1221ULL << 48); - return addr & (id << 24); + return addr | ((uint64_t)id << 24); } /* -- 2.5.0