From nobody Thu Jan 26 19:48:02 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P2rpp4DnQz3bnXQ; Thu, 26 Jan 2023 19:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P2rpp3ZK7z3DPd; Thu, 26 Jan 2023 19:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674762482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ODXKkGUTgdmunfySTbiS7eqFHX6W0ikpSkfvfvxz0jw=; b=P+cIiYnBUduen2Qr3EZXzjRzm565EcVxnUQQbg/eQCARu36+fIs5WRnBpfxlH2teQuvJl6 +8yDxQRAEN0/UAh+T8XtrmX5sBC6341hMn4IRYvLR1vmTGRWqZAWoVbq62wg35IgF8Vy1b 759EpghjfRdTYFXsj4/3S1L82IiQZHD5ZvT/ULSBUc1FpaGTRqxJSHfmKz+ab7et31s9oJ shEnRwV1C9ixrJcGTyWC0g2kRvHI+EpUMJizrcmEbk8SBTZng5gyzkFEolElfWFKNy+DjS ERvC53qkBk9ach1zfUN8GGapLUCqbfcR4bqvVjdfSfelMKgOOj0j/B/VnTmudw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674762482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ODXKkGUTgdmunfySTbiS7eqFHX6W0ikpSkfvfvxz0jw=; b=Q+41pCREfeE7UUAUpiRYJNuK/nAm2L2F+3sxv0dUbsOrSDgfvDZbIejBUKJMflhB1QW6n/ wAUHO603NNHBPAt0LGHHdrqwIEEzXGc+u+tvnYVCT5uSvGvCUuw5I0CdY+A0Gv4fALOhVq j4Evxj3KKXpVnG42fSNHkm/eHGMGxxZAPeeQ4ooEZWlu/9mh8k9w2TBs0IB6piKE249FDF 76RkZhphMaEa6J9qEVl/46c222vfAeOoen74YlaiPR+0r3/bxepqIQ6CFHh3aayejMwg1E bY8fdE8/QjjVsaVffbBfN2szMb4BABuFcTszW3IOHWZvQAiCZR4XecBEqPiSHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674762482; a=rsa-sha256; cv=none; b=ZQejuBYqJwqU2lZLTLZTGnQQwJL7zbaXhvQz7Ctf5j78ok2ZzdUMRvbqoAAqjBiUQgbdnD NqtCzeR8jA4YraC6EALavTOUkNNHlkPhhdR3T+O3O7v1av75KvtRn/h4beLMw04Cs/l5vC 14ufPgsPBltxFGLpR4kMw0HLn4OZ2uI23oGItwmBQLe4GwuOBa5G5ANnDu9fGIe6qFmi/z ge7wOljImScHwb/FowyFAZoK7xfmBsuEiXBLsUWC+FukGoTpFgu2oLwjG49yOfhm2TU3nn dnuDxvqdNFtGv/HRKPXHxrRHmZcIdB5yW0nXegVM4+vBp0ztFpasWaTOgY0m6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P2rpp2NpZzhl1; Thu, 26 Jan 2023 19:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30QJm2S5007428; Thu, 26 Jan 2023 19:48:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QJm2aS007427; Thu, 26 Jan 2023 19:48:02 GMT (envelope-from git) Date: Thu, 26 Jan 2023 19:48:02 GMT Message-Id: <202301261948.30QJm2aS007427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 04601ccc9581 - stable/13 - bhyve: Address signed/unsigned comparison warnings in the AHCI model List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 04601ccc95814cb97dabae3d2cb569fe7d677e22 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=04601ccc95814cb97dabae3d2cb569fe7d677e22 commit 04601ccc95814cb97dabae3d2cb569fe7d677e22 Author: Mark Johnston AuthorDate: 2022-10-25 13:39:07 +0000 Commit: John Baldwin CommitDate: 2023-01-26 19:43:10 +0000 bhyve: Address signed/unsigned comparison warnings in the AHCI model No functional change intended. MFC after: 1 week (cherry picked from commit f0553616cf78c94e7589921d2354477b948e4876) --- usr.sbin/bhyve/pci_ahci.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index d4000b7a63c6..4571f4caeffb 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -615,8 +615,10 @@ ahci_build_iov(struct ahci_port *p, struct ahci_ioreq *aior, struct ahci_prdt_entry *prdt, uint16_t prdtl) { struct blockif_req *breq = &aior->io_req; - int i, j, skip, todo, left, extra; - uint32_t dbcsz; + uint32_t dbcsz, extra, left, skip, todo; + int i, j; + + assert(aior->len >= aior->done); /* Copy part of PRDT between 'done' and 'len' bytes into the iov. */ skip = aior->done; @@ -785,12 +787,14 @@ ahci_handle_flush(struct ahci_port *p, int slot, uint8_t *cfis) } static inline void -read_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, int size) +read_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, + unsigned int size) { struct ahci_cmd_hdr *hdr; struct ahci_prdt_entry *prdt; uint8_t *to; - int i, len; + unsigned int len; + int i; hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); len = size; @@ -799,7 +803,7 @@ read_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, int size) for (i = 0; i < hdr->prdtl && len; i++) { uint8_t *ptr; uint32_t dbcsz; - int sublen; + unsigned int sublen; dbcsz = (prdt->dbc & DBCMASK) + 1; ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz); @@ -898,12 +902,14 @@ next: } static inline void -write_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, int size) +write_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, + unsigned int size) { struct ahci_cmd_hdr *hdr; struct ahci_prdt_entry *prdt; uint8_t *from; - int i, len; + unsigned int len; + int i; hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); len = size; @@ -1140,7 +1146,7 @@ atapi_inquiry(struct ahci_port *p, int slot, uint8_t *cfis) { uint8_t buf[36]; uint8_t *acmd; - int len; + unsigned int len; uint32_t tfd; acmd = cfis + 0x40; @@ -1202,7 +1208,7 @@ atapi_read_toc(struct ahci_port *p, int slot, uint8_t *cfis) { uint8_t *acmd; uint8_t format; - int len; + unsigned int len; acmd = cfis + 0x40; @@ -1211,7 +1217,8 @@ atapi_read_toc(struct ahci_port *p, int slot, uint8_t *cfis) switch (format) { case 0: { - int msf, size; + size_t size; + int msf; uint64_t sectors; uint8_t start_track, buf[20], *bp; @@ -1285,7 +1292,8 @@ atapi_read_toc(struct ahci_port *p, int slot, uint8_t *cfis) } case 2: { - int msf, size; + size_t size; + int msf; uint64_t sectors; uint8_t *bp, buf[50]; @@ -1448,7 +1456,7 @@ atapi_request_sense(struct ahci_port *p, int slot, uint8_t *cfis) { uint8_t buf[64]; uint8_t *acmd; - int len; + unsigned int len; acmd = cfis + 0x40; len = acmd[4]; @@ -1494,7 +1502,7 @@ atapi_mode_sense(struct ahci_port *p, int slot, uint8_t *cfis) uint8_t *acmd; uint32_t tfd; uint8_t pc, code; - int len; + unsigned int len; acmd = cfis + 0x40; len = be16dec(acmd + 7); @@ -1579,7 +1587,7 @@ atapi_get_event_status_notification(struct ahci_port *p, int slot, tfd = (p->sense_key << 12) | ATA_S_READY | ATA_S_ERROR; } else { uint8_t buf[8]; - int len; + unsigned int len; len = be16dec(acmd + 7); if (len > sizeof(buf)) @@ -2202,7 +2210,7 @@ pci_ahci_write(struct vmctx *ctx __unused, int vcpu __unused, if (offset < AHCI_OFFSET) pci_ahci_host_write(sc, offset, value); - else if (offset < AHCI_OFFSET + sc->ports * AHCI_STEP) + else if (offset < (uint64_t)AHCI_OFFSET + sc->ports * AHCI_STEP) pci_ahci_port_write(sc, offset, value); else WPRINTF("pci_ahci: unknown i/o write offset 0x%"PRIx64"", offset); @@ -2300,7 +2308,7 @@ pci_ahci_read(struct vmctx *ctx __unused, int vcpu __unused, offset = regoff & ~0x3; /* round down to a multiple of 4 bytes */ if (offset < AHCI_OFFSET) value = pci_ahci_host_read(sc, offset); - else if (offset < AHCI_OFFSET + sc->ports * AHCI_STEP) + else if (offset < (uint64_t)AHCI_OFFSET + sc->ports * AHCI_STEP) value = pci_ahci_port_read(sc, offset); else { value = 0;