[PATCH 6.1] ubi: Add a check for ubi_num