git: c4b8fda2c88b - stable/13 - bhyve: Avoid arithmetic on void pointers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Nov 2022 13:52:37 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c4b8fda2c88bf785b1aa3cf6be859667995bac2a
commit c4b8fda2c88bf785b1aa3cf6be859667995bac2a
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-10-25 13:07:14 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
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++;