| 480 | } |
| 481 | |
| 482 | static uint64_t |
| 483 | xmul(uint64_t a, uint64_t b) |
| 484 | { |
| 485 | |
| 486 | if (b != 0 && a > UINT64_MAX / b) |
| 487 | return (UINT64_MAX); |
| 488 | |
| 489 | return (a * b); |
| 490 | } |
| 491 | |
| 492 | /* |
| 493 | * Check whether the proc 'p' can allocate 'amount' of 'resource' in addition |