These seem like easy cases where we can use mallocarray(9), however I am
unsure if doing such changes will increase the difficulty for future
merges.
Details
Details
- Reviewers
dumbbell pfg - Commits
- rS328261: drm2: Basic use of mallocarray(9).
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
TBH, I don't think there is any chance of an overflow with real hardware. Perhaps in a virtualized world there may be a chance to cause an overflow on anything or with specialized hardware (like the PS4 hackers did) but that's pretty extreme.
I am trying to keep the kernel consistent using mallocarray(9) where it can be used, but I am OK if you don't want this.
The code should be eaiser to read, but it will also make merging back the code to stable a nightmare.
Comment Actions
This should be a minimal and more straightforward replacement.
Note that we now panic if there is an overflow.
Comment Actions
This is small enough that shouldn't affect upstream merging (also the code is very FreeBSD-specific).
It also respects the general objective of the code.