From patchwork Thu Jun 13 14:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10992033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CCA514C0 for ; Thu, 13 Jun 2019 15:01:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C73C22362 for ; Thu, 13 Jun 2019 15:01:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00EF621FAC; Thu, 13 Jun 2019 15:01:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A331621C9A for ; Thu, 13 Jun 2019 15:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733052AbfFMPBu (ORCPT ); Thu, 13 Jun 2019 11:01:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57012 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732537AbfFMOfQ (ORCPT ); Thu, 13 Jun 2019 10:35:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B37CC30BBE97; Thu, 13 Jun 2019 14:35:07 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52FA31001B3A; Thu, 13 Jun 2019 14:35:01 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Rob Bradford , Eduardo Habkost , kvm@vger.kernel.org, Marcelo Tosatti , Samuel Ortiz , Yang Zhong , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Li Qiang Subject: [PATCH v2 01/20] hw/i386/pc: Use unsigned type to index arrays Date: Thu, 13 Jun 2019 16:34:27 +0200 Message-Id: <20190613143446.23937-2-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 13 Jun 2019 14:35:16 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 5 +++-- include/hw/i386/pc.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2c5446b095..bb3c74f4ca 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -874,7 +874,7 @@ static void handle_a20_line_change(void *opaque, int irq, int level) int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) { - int index = le32_to_cpu(e820_reserve.count); + unsigned int index = le32_to_cpu(e820_reserve.count); struct e820_entry *entry; if (type != E820_RAM) { @@ -906,7 +906,8 @@ int e820_get_num_entries(void) return e820_entries; } -bool e820_get_entry(int idx, uint32_t type, uint64_t *address, uint64_t *length) +bool e820_get_entry(unsigned int idx, uint32_t type, + uint64_t *address, uint64_t *length) { if (idx < e820_entries && e820_table[idx].type == cpu_to_le32(type)) { *address = le64_to_cpu(e820_table[idx].address); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a7d0b87166..3b3a0d6e59 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -291,7 +291,7 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); -bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); +bool e820_get_entry(unsigned int, uint32_t, uint64_t *, uint64_t *); extern GlobalProperty pc_compat_4_0_1[]; extern const size_t pc_compat_4_0_1_len;