linux/dim: Fix overflow in dim calculation