mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-25 01:55:19 +01:00
hpt27xx(4): Stop checking for failures from malloc(M_WAITOK)
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
This commit is contained in:
parent
4d47c7ca7b
commit
28e413a699
@ -94,9 +94,6 @@ static int hpt_attach(device_t dev)
|
|||||||
|
|
||||||
size = him->get_adapter_size(&pci_id);
|
size = him->get_adapter_size(&pci_id);
|
||||||
hba->ldm_adapter.him_handle = malloc(size, M_DEVBUF, M_WAITOK);
|
hba->ldm_adapter.him_handle = malloc(size, M_DEVBUF, M_WAITOK);
|
||||||
if (!hba->ldm_adapter.him_handle)
|
|
||||||
return ENXIO;
|
|
||||||
|
|
||||||
hba->pcidev = dev;
|
hba->pcidev = dev;
|
||||||
hba->pciaddr.tree = 0;
|
hba->pciaddr.tree = 0;
|
||||||
hba->pciaddr.bus = pci_get_bus(dev);
|
hba->pciaddr.bus = pci_get_bus(dev);
|
||||||
@ -114,10 +111,6 @@ static int hpt_attach(device_t dev)
|
|||||||
if (!ldm_register_adapter(&hba->ldm_adapter)) {
|
if (!ldm_register_adapter(&hba->ldm_adapter)) {
|
||||||
size = ldm_get_vbus_size();
|
size = ldm_get_vbus_size();
|
||||||
vbus_ext = malloc(sizeof(VBUS_EXT) + size, M_DEVBUF, M_WAITOK);
|
vbus_ext = malloc(sizeof(VBUS_EXT) + size, M_DEVBUF, M_WAITOK);
|
||||||
if (!vbus_ext) {
|
|
||||||
free(hba->ldm_adapter.him_handle, M_DEVBUF);
|
|
||||||
return ENXIO;
|
|
||||||
}
|
|
||||||
memset(vbus_ext, 0, sizeof(VBUS_EXT));
|
memset(vbus_ext, 0, sizeof(VBUS_EXT));
|
||||||
vbus_ext->ext_type = EXT_TYPE_VBUS;
|
vbus_ext->ext_type = EXT_TYPE_VBUS;
|
||||||
ldm_create_vbus((PVBUS)vbus_ext->vbus, vbus_ext);
|
ldm_create_vbus((PVBUS)vbus_ext->vbus, vbus_ext);
|
||||||
@ -168,7 +161,6 @@ static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
|
|||||||
f->tag, f->count, f->size, f->count*f->size));
|
f->tag, f->count, f->size, f->count*f->size));
|
||||||
for (i=0; i<f->count; i++) {
|
for (i=0; i<f->count; i++) {
|
||||||
p = (void **)malloc(f->size, M_DEVBUF, M_WAITOK);
|
p = (void **)malloc(f->size, M_DEVBUF, M_WAITOK);
|
||||||
if (!p) return (ENXIO);
|
|
||||||
*p = f->head;
|
*p = f->head;
|
||||||
f->head = p;
|
f->head = p;
|
||||||
}
|
}
|
||||||
@ -1109,10 +1101,6 @@ static void hpt_final_init(void *dummy)
|
|||||||
|
|
||||||
for (i=0; i<os_max_queue_comm; i++) {
|
for (i=0; i<os_max_queue_comm; i++) {
|
||||||
POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
|
POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
|
||||||
if (!ext) {
|
|
||||||
os_printk("Can't alloc cmdext(%d)", i);
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
ext->vbus_ext = vbus_ext;
|
ext->vbus_ext = vbus_ext;
|
||||||
ext->next = vbus_ext->cmdext_list;
|
ext->next = vbus_ext->cmdext_list;
|
||||||
vbus_ext->cmdext_list = ext;
|
vbus_ext->cmdext_list = ext;
|
||||||
@ -1327,18 +1315,13 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, stru
|
|||||||
|
|
||||||
if (ioctl_args.nInBufferSize) {
|
if (ioctl_args.nInBufferSize) {
|
||||||
ioctl_args.lpInBuffer = malloc(ioctl_args.nInBufferSize, M_DEVBUF, M_WAITOK);
|
ioctl_args.lpInBuffer = malloc(ioctl_args.nInBufferSize, M_DEVBUF, M_WAITOK);
|
||||||
if (!ioctl_args.lpInBuffer)
|
|
||||||
goto invalid;
|
|
||||||
if (copyin((void*)piop->lpInBuffer,
|
if (copyin((void*)piop->lpInBuffer,
|
||||||
ioctl_args.lpInBuffer, piop->nInBufferSize))
|
ioctl_args.lpInBuffer, piop->nInBufferSize))
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl_args.nOutBufferSize) {
|
if (ioctl_args.nOutBufferSize)
|
||||||
ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO);
|
ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||||
if (!ioctl_args.lpOutBuffer)
|
|
||||||
goto invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
hpt_do_ioctl(&ioctl_args);
|
hpt_do_ioctl(&ioctl_args);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user