[PATCH 6.12 265/422] ubi: Add a check for ubi_num