Page MenuHomeFreeBSD

mpr: fix copying of event_mask
ClosedPublic

Authored by oshogbo on Apr 13 2023, 6:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 20 2024, 5:21 PM
Unknown Object (File)
Sep 20 2024, 10:10 AM
Unknown Object (File)
Sep 19 2024, 8:55 PM
Unknown Object (File)
Sep 18 2024, 11:33 AM
Unknown Object (File)
Sep 17 2024, 9:20 AM
Unknown Object (File)
Sep 14 2024, 5:28 AM
Unknown Object (File)
Sep 5 2024, 1:22 PM
Unknown Object (File)
Sep 1 2024, 1:19 PM
Subscribers

Details

Summary

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 sufisticated method, as the array is of size 4 (for 32 bits version).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

oshogbo retitled this revision from mpr: fix conversion to big endian to mpr: fix copying of event_mask.Apr 13 2023, 6:43 PM
oshogbo added a reviewer: Klara.
oshogbo added a reviewer: thj.
sys/dev/mpr/mpr.c
2767

16 seems wrong here and below, especially since we use MPI2_EVENT_NOTIFY_EVENTMASK_WORDS for the loops, maybe an expression with that?

sys/dev/mpr/mpr.c
2767

Actually is ok because we are copying an array of 16 elements of unit8_t to uint32_t of elements 4.
However, you are right I shouldn't hardcore the values (its from original code) I just used converted it to sizeof.

@imp Have you had a chance to look into this?

looks good. I'm torn on the other 16s since it's the other leg of the branch.
But the change itself looks good.

sys/dev/mpr/mpr.c
2761

the 16s here could also be changed, but that's starting to stray a bit from the remit of your change.

This revision is now accepted and ready to land.Apr 19 2023, 5:08 PM
This revision was automatically updated to reflect the committed changes.