git: 0386255bee07 - main - kboot: Disks should be at least 16MB
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 07 Jan 2023 20:22:37 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0386255bee079922f00f37eeb4e9e3138b7666c1 commit 0386255bee079922f00f37eeb4e9e3138b7666c1 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-12-13 05:39:03 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-01-07 20:20:44 +0000 kboot: Disks should be at least 16MB Linux pre-boot environments will often have a number of psuedo disks that are small, all smaller than a few MB. 16MB is a good cutoff since it's big enough to filter these devices, yet small enough to allow a super-minimal partition through (the smallest I've been able to make that's useful lately is around 20MB). Sponsored by: Netflix --- stand/kboot/hostdisk.c | 4 ++++ 1 file changed, 4 insertions(+) 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",