bhyve: Avoid arithmetic on void pointers
No functional change intended. MFC after: 1 week
This commit is contained in:
parent
3b6cb9b436
commit
03f7ccab32
@ -266,7 +266,7 @@ blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf)
|
|||||||
do {
|
do {
|
||||||
clen = MIN(len - boff, br->br_iov[i].iov_len -
|
clen = MIN(len - boff, br->br_iov[i].iov_len -
|
||||||
voff);
|
voff);
|
||||||
memcpy(br->br_iov[i].iov_base + voff,
|
memcpy((uint8_t *)br->br_iov[i].iov_base + voff,
|
||||||
buf + boff, clen);
|
buf + boff, clen);
|
||||||
if (clen < br->br_iov[i].iov_len - voff)
|
if (clen < br->br_iov[i].iov_len - voff)
|
||||||
voff += clen;
|
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 -
|
clen = MIN(len - boff, br->br_iov[i].iov_len -
|
||||||
voff);
|
voff);
|
||||||
memcpy(buf + boff,
|
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)
|
if (clen < br->br_iov[i].iov_len - voff)
|
||||||
voff += clen;
|
voff += clen;
|
||||||
else {
|
else {
|
||||||
|
@ -738,7 +738,7 @@ netmap_send(struct net_backend *be, const struct iovec *iov,
|
|||||||
int nm_buf_size;
|
int nm_buf_size;
|
||||||
int nm_buf_len;
|
int nm_buf_len;
|
||||||
uint32_t head;
|
uint32_t head;
|
||||||
void *nm_buf;
|
uint8_t *nm_buf;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
ring = priv->tx;
|
ring = priv->tx;
|
||||||
|
@ -785,12 +785,11 @@ ahci_handle_flush(struct ahci_port *p, int slot, uint8_t *cfis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
read_prdt(struct ahci_port *p, int slot, uint8_t *cfis,
|
read_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, int size)
|
||||||
void *buf, int size)
|
|
||||||
{
|
{
|
||||||
struct ahci_cmd_hdr *hdr;
|
struct ahci_cmd_hdr *hdr;
|
||||||
struct ahci_prdt_entry *prdt;
|
struct ahci_prdt_entry *prdt;
|
||||||
void *to;
|
uint8_t *to;
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE);
|
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
|
static inline void
|
||||||
write_prdt(struct ahci_port *p, int slot, uint8_t *cfis,
|
write_prdt(struct ahci_port *p, int slot, uint8_t *cfis, void *buf, int size)
|
||||||
void *buf, int size)
|
|
||||||
{
|
{
|
||||||
struct ahci_cmd_hdr *hdr;
|
struct ahci_cmd_hdr *hdr;
|
||||||
struct ahci_prdt_entry *prdt;
|
struct ahci_prdt_entry *prdt;
|
||||||
void *from;
|
uint8_t *from;
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE);
|
hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE);
|
||||||
|
@ -1394,7 +1394,8 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail,
|
|||||||
/* Include respective part of payload IOV. */
|
/* Include respective part of payload IOV. */
|
||||||
for (nleft = now; pv < iovcnt && nleft > 0; nleft -= nnow) {
|
for (nleft = now; pv < iovcnt && nleft > 0; nleft -= nnow) {
|
||||||
nnow = MIN(nleft, iov[pv].iov_len - pvoff);
|
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;
|
tiov[tiovcnt++].iov_len = nnow;
|
||||||
if (pvoff + nnow == iov[pv].iov_len) {
|
if (pvoff + nnow == iov[pv].iov_len) {
|
||||||
pv++;
|
pv++;
|
||||||
|
Loading…
Reference in New Issue
Block a user