Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142662593
D17000.id47980.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D17000.id47980.diff
View Options
Index: head/sys/compat/x86bios/x86bios.c
===================================================================
--- head/sys/compat/x86bios/x86bios.c
+++ head/sys/compat/x86bios/x86bios.c
@@ -656,17 +656,24 @@
x86bios_unmap_mem(void)
{
- free(x86bios_map, M_DEVBUF);
- if (x86bios_ivt != NULL)
+ if (x86bios_map != NULL) {
+ free(x86bios_map, M_DEVBUF);
+ x86bios_map = NULL;
+ }
+ if (x86bios_ivt != NULL) {
#ifdef X86BIOS_NATIVE_ARCH
pmap_unmapbios((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
#else
free(x86bios_ivt, M_DEVBUF);
+ x86bios_ivt = NULL;
#endif
+ }
if (x86bios_rom != NULL)
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
- if (x86bios_seg != NULL)
+ if (x86bios_seg != NULL) {
contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
+ x86bios_seg = NULL;
+ }
}
static __inline int
@@ -674,7 +681,9 @@
{
x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
+ if (x86bios_map == NULL)
+ goto fail;
#ifdef X86BIOS_NATIVE_ARCH
x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE);
@@ -688,7 +697,9 @@
rounddown(x86bios_rom_phys, X86BIOS_PAGE_SIZE);
else
#else
- x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_ZERO | M_WAITOK);
+ x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (x86bios_ivt == NULL)
+ goto fail;
#endif
x86bios_rom_phys = X86BIOS_ROM_BASE;
@@ -703,8 +714,10 @@
goto fail;
#endif
- x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_WAITOK,
+ x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_NOWAIT,
X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
+ if (x86bios_seg == NULL)
+ goto fail;
x86bios_seg_phys = vtophys(x86bios_seg);
x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 12:03 AM (10 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27868416
Default Alt Text
D17000.id47980.diff (1 KB)
Attached To
Mode
D17000: x86bios: use M_NOWAIT with mallocs
Attached
Detach File
Event Timeline
Log In to Comment