Page MenuHomeFreeBSD

Make use of mallocarray(9) in drm drivers.
ClosedPublic

Authored by pfg on Jan 10 2018, 8:40 PM.
Tags
None
Referenced Files
F135502430: D13835.id37871.diff
Mon, Nov 10, 9:09 AM
F135447439: D13835.id37871.diff
Sun, Nov 9, 11:09 PM
F135445878: D13835.id38314.diff
Sun, Nov 9, 10:53 PM
F135436491: D13835.diff
Sun, Nov 9, 8:48 PM
F135435658: D13835.id37748.diff
Sun, Nov 9, 8:35 PM
F135435561: D13835.id.diff
Sun, Nov 9, 8:34 PM
F135419088: D13835.id37871.diff
Sun, Nov 9, 4:52 PM
Unknown Object (File)
Sun, Nov 9, 4:06 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14335
Build 14493: arc lint + arc unit

Event Timeline

Hi!

What is the benefit of using mallocarray() here?

Hi!

What is the benefit of using mallocarray() here?

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.

This should be a minimal and more straightforward replacement.

Note that we now panic if there is an overflow.

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.

This revision is now accepted and ready to land.Jan 22 2018, 2:35 AM

Yes, that's fine, the patch is small enough. Thank you!

This revision was automatically updated to reflect the committed changes.