From nobody Tue Oct 25 15:17:09 2022 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 4MxbC93WLjz4g4f0; Tue, 25 Oct 2022 15:17:09 +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 4MxbC9259Gz3xfp; Tue, 25 Oct 2022 15:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666711029; 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=XmTwwPzS4hfTOvjYpzRnJUGdhx99cSfRQAto0EGfdH0=; b=ayY9LbkH/NdnDowig9n3Ecdpz5h2GxEmLtP/R8O4t6FvLCCNvMt1oHW7z8+TTO4VctI5mc sAIUqGYtozokLx7dkg2xIj78BCcr9SBXx70lh4/MMQHI76DH+m6TOlZp/HVfT480vLrlT8 hHNa2hW625X6InZ/op6/KatqKP4FaMCzR4kM1TLXc8WX7kHkjwwQ++2JoFl23VrHuoZ2Fk c+2tuMBgJkTctxguF02aiK+xeikioL3p/OtbFYawgG2pUwER3pE46zzczCTC8COsK8ixz7 bzXq8Kn8HrP05zw8jg3nLT+1c2fZVB7n/3Sz7HEvbTaRWPsCX1kvP/ZEvCHGaQ== 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 4MxbC918fdzj2X; Tue, 25 Oct 2022 15:17:09 +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 29PFH9XA023237; Tue, 25 Oct 2022 15:17:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29PFH9UG023236; Tue, 25 Oct 2022 15:17:09 GMT (envelope-from git) Date: Tue, 25 Oct 2022 15:17:09 GMT Message-Id: <202210251517.29PFH9UG023236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f0553616cf78 - main - 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0553616cf78c94e7589921d2354477b948e4876 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666711029; 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=XmTwwPzS4hfTOvjYpzRnJUGdhx99cSfRQAto0EGfdH0=; b=FXyyXkqIZ9xRkFhkmIraiTanGwgZAmOEZbD95OkF6Vq4Jpk9R4pOY1Tmbun61JD+vv6NSE WRd4lUJA7jNFJeisfILstVJKdzibaCA+pybMTQ/DJgFy9MsyHrlW5YDpqLaJ8Lj3roHKBs ni/YBfffAxbGCAJtrCTNqRQjPWWr367lAPd2NjcBCLITbhfApepHcVu0xz4utQPzQ3zBq4 i2u29yP5SJxTxf3nX7jYsGZ2rWXQKeHv6+CRQQYjhvhnJ8hfx/my1vp5sxgWCX1v+GVDNz yKAGOiHpJBWJM49mAAKQiLXZVpxj37hPgO5GbkFpZjVzAf+I77b/DFrTqRPF2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666711029; a=rsa-sha256; cv=none; b=Z6ChfqZ2NHCxaXbcr0jGPfDmfghjdmm9moBmEcXhrfvHp3SKIrriknQ7OoPbsBXKPzR2lD jP1qa7nBv65/3tuq+qbZJQQ8cXSXPiQO00UqEQDBI4fqCuNVm2yuQe+X5nnO/jdZuCvs7n QcRWvnPLYhBEd9ATSLsPo7HbXFRaNgBZRqsoMGchP4QJDYNAAY8b8STzf682ifrSh+uB+o pIq5f/DNy8+r3WrMvDyTACCosv457nb87XQqHq1L8yhbq82ca2KwZAEAxASymRJl5HNCTg nuYYf1QZFdVv07xckjekDniFui0C2BpjxwYPvsOp02RCCXEQkWADPz5+Tmu4Iw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f0553616cf78c94e7589921d2354477b948e4876 commit f0553616cf78c94e7589921d2354477b948e4876 Author: Mark Johnston AuthorDate: 2022-10-25 13:39:07 +0000 Commit: Mark Johnston CommitDate: 2022-10-25 15:16:57 +0000 bhyve: Address signed/unsigned comparison warnings in the AHCI model No functional change intended. MFC after: 1 week --- 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;