Date: Mon, 18 Feb 2013 14:20:55 +0100 From: Christoph Mallon <christoph.mallon@gmx.de> To: FreeBSD-gnats-submit@freebsd.org Cc: Christoph Mallon <christoph.mallon@gmx.de> Subject: kern/176238: [PATCH] ath: Correct buffer size calculation and simplify calling if_ath_alq_post() Message-ID: <E1U7QeN-000CUD-UK@rotluchs.lokal> Resent-Message-ID: <201302181330.r1IDU10q090599@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 176238 >Category: kern >Synopsis: [PATCH] ath: Correct buffer size calculation and simplify calling if_ath_alq_post() >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 18 13:30:01 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Christoph Mallon >Release: >Organization: >Environment: >Description: These patches address two points: - Correct buffer size calculation when calling if_ath_alq_post_in() in if_ath_alq_post_intr() - Avoid explicit casts for calling if_ath_alq_post() by making buf a const void* >How-To-Repeat: >Fix: Please apply these patches. --- 0001-ath-Correct-sizeof-calculation-in-if_ath_alq_post_in.patch begins here --- >From a709ff6df2db2ddb5b87ec7dd2da2f1df5f6f308 Mon Sep 17 00:00:00 2001 From: Christoph Mallon <christoph.mallon@gmx.de> Date: Mon, 18 Feb 2013 10:27:26 +0100 Subject: [PATCH 1/2] ath: Correct sizeof calculation in if_ath_alq_post_intr(). This bug was introduced in r246933. --- sys/dev/ath/if_ath_alq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ath/if_ath_alq.h b/sys/dev/ath/if_ath_alq.h index 52a022d..541f2d7 100644 --- a/sys/dev/ath/if_ath_alq.h +++ b/sys/dev/ath/if_ath_alq.h @@ -168,7 +168,7 @@ if_ath_alq_post_intr(struct if_ath_alq *alq, uint32_t status, intr.intr_state[i] = htobe32(state[i]); intr.intr_syncstate = htobe32(sync_state); - if_ath_alq_post(alq, ATH_ALQ_INTR_STATUS, sizeof(&intr), + if_ath_alq_post(alq, ATH_ALQ_INTR_STATUS, sizeof(intr), (const char *) &intr); } -- 1.8.1.3 --- 0001-ath-Correct-sizeof-calculation-in-if_ath_alq_post_in.patch ends here --- --- dummy1 begins here --- dummy file, because GNATS damages every other patch --- dummy1 ends here --- --- 0002-ath-Simplify-usage-of-if_ath_alq_post-by-changing-th.patch begins here --- >From ef203f1c533dd050ad18108cd7d1436d5eb26d67 Mon Sep 17 00:00:00 2001 From: Christoph Mallon <christoph.mallon@gmx.de> Date: Mon, 18 Feb 2013 10:30:15 +0100 Subject: [PATCH 2/2] ath: Simplify usage of if_ath_alq_post() by changing the type of buf to const void*. --- sys/dev/ath/if_ath.c | 3 +-- sys/dev/ath/if_ath_alq.c | 5 ++--- sys/dev/ath/if_ath_alq.h | 5 ++--- sys/dev/ath/if_ath_rx.c | 2 +- sys/dev/ath/if_ath_rx_edma.c | 2 +- sys/dev/ath/if_ath_tdma.c | 10 +++++----- sys/dev/ath/if_ath_tx_edma.c | 3 +-- 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index b6b4217..c497361 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -3820,8 +3820,7 @@ ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS)) { if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS, - sc->sc_tx_statuslen, - (char *) ds); + sc->sc_tx_statuslen, ds); } #endif diff --git a/sys/dev/ath/if_ath_alq.c b/sys/dev/ath/if_ath_alq.c index 1ad13db..48b98e6 100644 --- a/sys/dev/ath/if_ath_alq.c +++ b/sys/dev/ath/if_ath_alq.c @@ -121,8 +121,7 @@ if_ath_alq_start(struct if_ath_alq *alq) printf("%s (%s): opened\n", __func__, alq->sc_alq_devname); alq->sc_alq_isactive = 1; if_ath_alq_post(alq, ATH_ALQ_INIT_STATE, - sizeof (struct if_ath_alq_init_state), - (char *) &alq->sc_alq_cfg); + sizeof(alq->sc_alq_cfg), &alq->sc_alq_cfg); } return (error); } @@ -150,7 +149,7 @@ if_ath_alq_stop(struct if_ath_alq *alq) */ void if_ath_alq_post(struct if_ath_alq *alq, uint16_t op, uint16_t len, - const char *buf) + const void *buf) { struct if_ath_alq_hdr *ap; struct ale *ale; diff --git a/sys/dev/ath/if_ath_alq.h b/sys/dev/ath/if_ath_alq.h index 541f2d7..10a00b1 100644 --- a/sys/dev/ath/if_ath_alq.h +++ b/sys/dev/ath/if_ath_alq.h @@ -150,7 +150,7 @@ extern void if_ath_alq_tidyup(struct if_ath_alq *alq); extern int if_ath_alq_start(struct if_ath_alq *alq); extern int if_ath_alq_stop(struct if_ath_alq *alq); extern void if_ath_alq_post(struct if_ath_alq *alq, uint16_t op, - uint16_t len, const char *buf); + uint16_t len, const void *buf); /* XXX maybe doesn't belong here? */ static inline void @@ -168,8 +168,7 @@ if_ath_alq_post_intr(struct if_ath_alq *alq, uint32_t status, intr.intr_state[i] = htobe32(state[i]); intr.intr_syncstate = htobe32(sync_state); - if_ath_alq_post(alq, ATH_ALQ_INTR_STATUS, sizeof(intr), - (const char *) &intr); + if_ath_alq_post(alq, ATH_ALQ_INTR_STATUS, sizeof(intr), &intr); } #endif /* _KERNEL */ diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c index 139e894..a9d9e77 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -921,7 +921,7 @@ ath_rx_proc(struct ath_softc *sc, int resched) #ifdef ATH_DEBUG_ALQ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS)) if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS, - sc->sc_rx_statuslen, (char *) ds); + sc->sc_rx_statuslen, ds); #endif /* ATH_DEBUG_ALQ */ if (status == HAL_EINPROGRESS) diff --git a/sys/dev/ath/if_ath_rx_edma.c b/sys/dev/ath/if_ath_rx_edma.c index 301a22c..e599f1c 100644 --- a/sys/dev/ath/if_ath_rx_edma.c +++ b/sys/dev/ath/if_ath_rx_edma.c @@ -365,7 +365,7 @@ ath_edma_recv_proc_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype, #ifdef ATH_DEBUG_ALQ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS)) if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS, - sc->sc_rx_statuslen, (char *) ds); + sc->sc_rx_statuslen, ds); #endif /* ATH_DEBUG */ if (bf->bf_rxstatus == HAL_EINPROGRESS) break; diff --git a/sys/dev/ath/if_ath_tdma.c b/sys/dev/ath/if_ath_tdma.c index 5cfe238..0606e77 100644 --- a/sys/dev/ath/if_ath_tdma.c +++ b/sys/dev/ath/if_ath_tdma.c @@ -170,7 +170,7 @@ ath_tdma_settimers(struct ath_softc *sc, u_int32_t nexttbtt, u_int32_t bintval) t.sc_tdmadbaprep = htobe32(sc->sc_tdmadbaprep); t.sc_tdmaswbaprep = htobe32(sc->sc_tdmaswbaprep); if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_SET, - sizeof(t), (char *) &t); + sizeof(t), &t); } #endif @@ -315,7 +315,7 @@ ath_tdma_config(struct ath_softc *sc, struct ieee80211vap *vap) t.tdma_dbaprep = htobe32(sc->sc_tdmadbaprep); if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_CONFIG, - sizeof(t), (char *) &t); + sizeof(t), &t); } #endif /* ATH_DEBUG_ALQ */ } @@ -479,7 +479,7 @@ ath_tdma_update(struct ieee80211_node *ni, t.nextslot_tu = htobe32(nextslottu); t.txtime = htobe32(txtime); if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE, - sizeof(t), (char *) &t); + sizeof(t), &t); } if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC)) { @@ -492,7 +492,7 @@ ath_tdma_update(struct ieee80211_node *ni, t.avg_minus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltam)); if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC, - sizeof(t), (char *) &t); + sizeof(t), &t); } #endif @@ -554,7 +554,7 @@ ath_tdma_update(struct ieee80211_node *ni, t.tsf64_old = htobe64(tsf); t.tsf64_new = htobe64(tsf + tsfdelta); if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TSF_ADJUST, - sizeof(t), (char *) &t); + sizeof(t), &t); } #endif /* ATH_DEBUG_ALQ */ sc->sc_stats.ast_tdma_tsf++; diff --git a/sys/dev/ath/if_ath_tx_edma.c b/sys/dev/ath/if_ath_tx_edma.c index 6c6889c..c7a1b7a 100644 --- a/sys/dev/ath/if_ath_tx_edma.c +++ b/sys/dev/ath/if_ath_tx_edma.c @@ -498,8 +498,7 @@ ath_edma_tx_processq(struct ath_softc *sc, int dosched) #ifdef ATH_DEBUG_ALQ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS)) if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS, - sc->sc_tx_statuslen, - (char *) txstatus); + sc->sc_tx_statuslen, txstatus); #endif /* ATH_DEBUG_ALQ */ /* -- 1.8.1.3 --- 0002-ath-Simplify-usage-of-if_ath_alq_post-by-changing-th.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1U7QeN-000CUD-UK>