git: c7b05da29795 - releng/12.4 - mpr: fix copying of event_mask
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Jun 2023 05:42:24 UTC
The branch releng/12.4 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=c7b05da29795f263c0b511d8ef4755a784439dc4 commit c7b05da29795f263c0b511d8ef4755a784439dc4 Author: Mariusz Zaborski <oshogbo@FreeBSD.org> AuthorDate: 2023-04-21 07:50:16 +0000 Commit: Gordon Tetlow <gordon@FreeBSD.org> CommitDate: 2023-06-21 05:08:39 +0000 mpr: fix copying of event_mask Before the commit 6cc44223cb6717795afdac4348bbe7e2a968a07d the field event_mask was fully copied to the EventMasks field. After this commit the event_mask (uint8_t) is 4 times casted to EventMask (uint32_t). Because of that 24 bits of each event_mask array is lost. This commits brings back simple copying of field, and after words converting 32 bits field to the requested endian. I don't think we need more sophisticated method, as the array is of size 4 (for 32 bits version). Reviewed by: imp MFC after: 1 week Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D39562 (cherry picked from commit ea6597c38c77c7bfaae71259d8636cbb89add6a3) (cherry picked from commit 2de69df6f398987cecbc5ac02b2183c561e0f220) Approved by: so Security: FreeBSD-EN-23:07.mpr --- sys/dev/mpr/mpr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index 308c88112168..33afb7adf852 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -2795,8 +2795,9 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_event_handle *handle, bcopy(fullmask, (uint8_t *)&evtreq->EventMasks, 16); } #else + bcopy(sc->event_mask, (uint8_t *)&evtreq->EventMasks, sizeof(sc->event_mask)); for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) - evtreq->EventMasks[i] = htole32(sc->event_mask[i]); + evtreq->EventMasks[i] = htole32(evtreq->EventMasks[i]); #endif cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; @@ -2850,8 +2851,9 @@ mpr_reregister_events(struct mpr_softc *sc) bcopy(fullmask, (uint8_t *)&evtreq->EventMasks, 16); } #else + bcopy(sc->event_mask, (uint8_t *)&evtreq->EventMasks, sizeof(sc->event_mask)); for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) - evtreq->EventMasks[i] = htole32(sc->event_mask[i]); + evtreq->EventMasks[i] = htole32(evtreq->EventMasks[i]); #endif cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL;