aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-06-30 18:49:46 +0000
committerMarcin Wojtas <mw@FreeBSD.org>2022-07-26 19:33:05 +0000
commit5393b9247fb0262441c21534e2f9d41cff81fc4d (patch)
treeb798609a61b1e0f681a7618a4c2dc0a921691214
parent7f12992281c7b8e2db59463982195b6ea6b4280d (diff)
downloadsrc-5393b9247fb0262441c21534e2f9d41cff81fc4d.tar.gz
src-5393b9247fb0262441c21534e2f9d41cff81fc4d.zip
ena: Make first_interrupt a uint8_t
We do not have atomic(9) routines for bools, and it is not guaranteed that sizeof(bool) is 1. This fixes the KASAN and KMSAN kernel builds, which fail because the compiler refuses to silently cast a _Bool * to a uint8_t * when calling the atomic(9) sanitizer interceptors. Reviewed by: Dawid Górecki <dgr@semihalf.com> MFC after: 2 weeks Fixes: 0ac122c388d9 ("ena: Use atomic_load/store functions for first_interrupt variable") Differential Revision: https://reviews.freebsd.org/D35683 (cherry picked from commit b72f1f4516896ad6da0ea74d146a56045de171f7)
-rw-r--r--sys/dev/ena/ena.c2
-rw-r--r--sys/dev/ena/ena.h2
-rw-r--r--sys/dev/ena/ena_datapath.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index a7d177454075..3efc0021a746 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -376,7 +376,7 @@ ena_init_io_rings_common(struct ena_adapter *adapter, struct ena_ring *ring,
ring->qid = qid;
ring->adapter = adapter;
ring->ena_dev = adapter->ena_dev;
- atomic_store_8(&ring->first_interrupt, false);
+ atomic_store_8(&ring->first_interrupt, 0);
ring->no_interrupt_event_cnt = 0;
}
diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h
index 013b7f0360cc..b6cf9b8d3758 100644
--- a/sys/dev/ena/ena.h
+++ b/sys/dev/ena/ena.h
@@ -328,7 +328,7 @@ struct ena_ring {
uint16_t rx_mbuf_sz;
};
- bool first_interrupt;
+ uint8_t first_interrupt;
uint16_t no_interrupt_event_cnt;
struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];
diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c
index a5c4eec43f67..9b41f4bcc773 100644
--- a/sys/dev/ena/ena_datapath.c
+++ b/sys/dev/ena/ena_datapath.c
@@ -91,8 +91,8 @@ ena_cleanup(void *arg, int pending)
ena_qid = ENA_IO_TXQ_IDX(qid);
io_cq = &adapter->ena_dev->io_cq_queues[ena_qid];
- atomic_store_8(&tx_ring->first_interrupt, true);
- atomic_store_8(&rx_ring->first_interrupt, true);
+ atomic_store_8(&tx_ring->first_interrupt, 1);
+ atomic_store_8(&rx_ring->first_interrupt, 1);
for (i = 0; i < ENA_CLEAN_BUDGET; ++i) {
rxc = ena_rx_cleanup(rx_ring);