git: 85d8155e9526 - stable/13 - kboot: Disks should be at least 16MB
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 22:14:13 UTC
The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=85d8155e952613e03ab444947405ec0d9183e3b0 commit 85d8155e952613e03ab444947405ec0d9183e3b0 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-12-13 05:39:03 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-01-24 21:49:45 +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 (cherry picked from commit 0386255bee079922f00f37eeb4e9e3138b7666c1) --- 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",