Page MenuHomeFreeBSD

D15667.id43339.diff
No OneTemporary

D15667.id43339.diff

Index: sys/powerpc/ofw/ofw_machdep.c
===================================================================
--- sys/powerpc/ofw/ofw_machdep.c
+++ sys/powerpc/ofw/ofw_machdep.c
@@ -294,19 +294,36 @@
excise_initrd_region(struct mem_region *avail, int asz)
{
phandle_t chosen;
+ pcell_t cell[2];
uint64_t start, end;
ssize_t size;
struct mem_region initrdmap[1];
chosen = OF_finddevice("/chosen");
- size = OF_getprop(chosen, "linux,initrd-start", &start, sizeof(start));
+
+ size = OF_getencprop(chosen, "linux,initrd-start", cell, sizeof(cell));
if (size <= 0)
return (asz);
- size = OF_getprop(chosen, "linux,initrd-end", &end, sizeof(end));
+ KASSERT(size == 4 || size == 8, ("linux,initrd-start, when present, must be either 4 or 8 bytes long"));
+ if (size == 4)
+ start = cell[0];
+ else
+ start = (uint64_t)cell[0] << 32 | cell[1];
+
+ size = OF_getencprop(chosen, "linux,initrd-end", cell, sizeof(cell));
if (size <= 0)
return (asz);
+ KASSERT(size == 4 || size == 8, ("linux,initrd-end, when present, must be either 4 or 8 bytes long"));
+ if (size == 4)
+ end = cell[0];
+ else
+ end = (uint64_t)cell[0] << 32 | cell[1];
+
+ if (end <= start)
+ return (asz);
+
initrdmap[0].mr_start = start;
initrdmap[0].mr_size = end - start;

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 4, 11:51 PM (11 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29261546
Default Alt Text
D15667.id43339.diff (1 KB)

Event Timeline