<!-- canonical: https://0xsimao.com/findings/m-0-overflow-power-divide-unnecessary -->

# Overflow check in PowerToken._divideUp is unnecessary

Low/Info · Three Sigma · Stablecoin framework · 8th January, 2024

Finding 3S-M^0-N10 of the M^0 Minter Gateway security review.

- Protocol: https://www.m0.org/
- Report: /reports/m-0
- Codebase: https://github.com/0xsimao/ttg/tree/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c
- Source: https://cdn.sanity.io/files/qoqld077/production/1cdafafad874aba76e062ad8c216c98338c096db.pdf

---

### Description

The [PowerToken._divideUp](https://github.com/MZero-Labs/ttg/blob/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c/src/PowerToken.sol#L427-L437) function checks if a result of a multiplication "wrapped" around
the maximum number, i.e. if it silently overflowed:

```solidity
z = (x * ONE) + y;
if (z < x) revert DivideUpOverflow();
```

Because calculation of z is not unchecked, the condition z < x will never be true, since
solidity 0.8 checks and reverts on overflow.

### Recommendation

Remove the line checking the z < x condition.

### Status

Acknowledged

---

Related findings:

- [Unnecessary user balance check in _withdrawRequest()](https://0xsimao.com/findings/glacier-unnecessary-balance-withdraw-request): Glacier
- [Anyone can get the NFT collateral token after an Auction without bidding due to missing check on msg.sender](https://0xsimao.com/findings/benddao-nft-collateral-auction-bidding): BendDAO
- [_tempTokenToCheck in BaseRouter does not need to be a state variable](https://0xsimao.com/findings/fuji-finance-temp-need-state-variable): Fuji Finance
