diff --git a/stand/kboot/hostdisk.c b/stand/kboot/hostdisk.c index bc31bef8e6d0..628450ef8bb5 100644 --- a/stand/kboot/hostdisk.c +++ b/stand/kboot/hostdisk.c @@ -60,6 +60,8 @@ struct devsw hostdisk = { */ #define SYSBLK "/sys/block" +#define HOSTDISK_MIN_SIZE (16ul << 20) /* 16MB */ + typedef STAILQ_HEAD(, hdinfo) hdinfo_list_t; typedef struct hdinfo { STAILQ_ENTRY(hdinfo) hd_link; /* link in device list */ @@ -162,6 +164,8 @@ hostdisk_add_drive(const char *drv, uint64_t secs) if (!file2u64(fn, &hd->hd_sectorsize)) goto err; hd->hd_size = hd->hd_sectors * hd->hd_sectorsize; + if (hd->hd_size < HOSTDISK_MIN_SIZE) + goto err; hd->hd_flags = 0; STAILQ_INIT(&hd->hd_children); printf("/dev/%s: %ju %ju %ju\n",