[PATCH] md: simplify checking of available size when resizing an array