bhyve: Avoid arithmetic on void pointers

No functional change intended.

MFC after:	1 week
This commit is contained in:
Mark Johnston 2022-10-25 09:07:14 -04:00
parent 3b6cb9b436
commit 03f7ccab32
4 changed files with 10 additions and 10 deletions

View File

@ -266,7 +266,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;
@ -302,7 +302,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 {

View File

@ -738,7 +738,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;

View File

@ -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 @@ ahci_handle_dsm_trim(struct ahci_port *p, int slot, uint8_t *cfis, uint32_t done
}
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);

View File

@ -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++;