From nobody Tue Nov 01 13:52:37 2022 X-Original-To: dev-commits-src-branches@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 4N1s0P3tpFz4gNG1; Tue, 1 Nov 2022 13:52:37 +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 4N1s0P3NPdz3gh6; Tue, 1 Nov 2022 13:52:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667310757; 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=osOSBBiA1VCwb8SB9m46/jzzS+XSalCRjXtKaeZGtco=; b=IWNO63Kohst1JjSSbaeBW7KV041ak8XZaMke4yeB4h6eBOWk+5Rl051bTW59OORiPNDALf IBtOMea4Upad9a4dFVl1NbQ4U7JYtX1xqq+YtdO8BBoqafsclMRqWrn1isWnE5m0eowNw2 KzygTB/2JzxhNHh7MIOVPJMokquQEQ8yM1SVmMf1x9CI1bSjPoagvU6XhLxYZs+TFdzrTx vPXEqHvq70KyU7Os8gQ4KwJdJhCowYl90wSahe7g6IYcddBdXTLHUv2uFs2t5cruvBs9pl DXosyq3GJqxxDT0Vs0wnM+x1k10CvTyt+AHlCqdf95vwDRQMwZjUYEZ8AG+2pQ== 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 4N1s0P2Rw2zJLL; Tue, 1 Nov 2022 13:52:37 +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 2A1DqbcM059167; Tue, 1 Nov 2022 13:52:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A1DqbUE059166; Tue, 1 Nov 2022 13:52:37 GMT (envelope-from git) Date: Tue, 1 Nov 2022 13:52:37 GMT Message-Id: <202211011352.2A1DqbUE059166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c4b8fda2c88b - stable/13 - bhyve: Avoid arithmetic on void pointers List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: c4b8fda2c88bf785b1aa3cf6be859667995bac2a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667310757; 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=osOSBBiA1VCwb8SB9m46/jzzS+XSalCRjXtKaeZGtco=; b=QZMvoCuuGTr1zR1MluQt76hiAlbWC6pbhyyWLwk8JWuAmvPQxgY6t3VLN9/p10fclj/jus PhE4TNA3jfqFeCKYYbTc0HS8efsa/eWDsKLtbrioGg1mu5bvZnFPYCKoOhfKxrVz3iT1b4 R4hm3W9PBtWwlTfhYQR+TfE3O8qj1YIXd3LhUo08+DShPDPr3mh2jt62RrNW9POmiHHf1/ yRaPAX/M0Y59KsgmUCRi7Jifhw8G4WwVH8soYtRVYJYZVZ7R8Q9LZ0BOsRp+fVhpy3pezG oDnIOaJTMoNHXZUU1ZnTn/tOKKi76AZgfCozp7iNdV/x5Zql0J8ifGL4ERXTLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667310757; a=rsa-sha256; cv=none; b=HWSwhnZU9LaIbMuzdJ7tsAuMTtG0BiZZwl4UrGCmSO7RYBII5RSReR9icgNdnTvH26kZZ2 /UfrpGbLstvTAWq0MVTI1vlwbAuVuxGPApzIWoNXziyd5m1bGHvMygP05qdyYVltNeGda+ F5uvu8tpLKPfz9LxEHZNXiKsC/7NhyhekyZ+IMpUgp3Li2B2+QLrnhmFUIV/dsklgXB7DE ++C7kCbMUhqvUM5AnNlZ7lb1qFWqZkVHYWNbNgNuGYnpapTDi+s+OIvG0v7F3DCaV1x7XU ldupnJEmcaXny7wFXHR/niom778kJqUYjBtVsgUWoR9d1lC1eD9XQsyNM0SBog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4b8fda2c88bf785b1aa3cf6be859667995bac2a commit c4b8fda2c88bf785b1aa3cf6be859667995bac2a Author: Mark Johnston AuthorDate: 2022-10-25 13:07:14 +0000 Commit: Mark Johnston CommitDate: 2022-11-01 13:46:18 +0000 bhyve: Avoid arithmetic on void pointers No functional change intended. (cherry picked from commit 03f7ccab32078467ff0df14c7996747269a1962c) --- usr.sbin/bhyve/block_if.c | 5 +++-- usr.sbin/bhyve/net_backends.c | 2 +- usr.sbin/bhyve/pci_ahci.c | 10 ++++------ usr.sbin/bhyve/pci_e82545.c | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index a6b1c11a842c..7cfaf4c7a40e 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -267,7 +267,7 @@ blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf) do { clen = MIN(len - boff, br->br_iov[i].iov_len - voff); - memcpy(br->br_iov[i].iov_base + voff, + memcpy((uint8_t *)br->br_iov[i].iov_base + voff, buf + boff, clen); if (clen < br->br_iov[i].iov_len - voff) voff += clen; @@ -303,7 +303,8 @@ blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf) clen = MIN(len - boff, br->br_iov[i].iov_len - voff); memcpy(buf + boff, - br->br_iov[i].iov_base + voff, clen); + (uint8_t *)br->br_iov[i].iov_base + voff, + clen); if (clen < br->br_iov[i].iov_len - voff) voff += clen; else { diff --git a/usr.sbin/bhyve/net_backends.c b/usr.sbin/bhyve/net_backends.c index 416e1e253e95..22d489db0793 100644 --- a/usr.sbin/bhyve/net_backends.c +++ b/usr.sbin/bhyve/net_backends.c @@ -739,7 +739,7 @@ netmap_send(struct net_backend *be, const struct iovec *iov, int nm_buf_size; int nm_buf_len; uint32_t head; - void *nm_buf; + uint8_t *nm_buf; int j; ring = priv->tx; diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 3a25121b8eed..5a2a06029fc9 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -785,12 +785,11 @@ 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, int size) { struct ahci_cmd_hdr *hdr; struct ahci_prdt_entry *prdt; - void *to; + uint8_t *to; int i, len; hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); @@ -899,12 +898,11 @@ 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, int size) { struct ahci_cmd_hdr *hdr; struct ahci_prdt_entry *prdt; - void *from; + uint8_t *from; int i, len; hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c index 63820ae71f2c..ffa1989c8f52 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -1394,7 +1394,8 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, /* Include respective part of payload IOV. */ for (nleft = now; pv < iovcnt && nleft > 0; nleft -= nnow) { nnow = MIN(nleft, iov[pv].iov_len - pvoff); - tiov[tiovcnt].iov_base = iov[pv].iov_base + pvoff; + tiov[tiovcnt].iov_base = (uint8_t *)iov[pv].iov_base + + pvoff; tiov[tiovcnt++].iov_len = nnow; if (pvoff + nnow == iov[pv].iov_len) { pv++;