Messages in this thread Patch in this message |  | | Date | Tue, 22 Aug 2000 08:19:37 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | [PATCH] drivers/scsi/eata_dma.c: checking kmallocs |
| |
Hi,
Please take a look and consider applying.
- Arnaldo
--- linux-2.4.0-test7-pre5/drivers/scsi/eata_dma.c Mon Jun 19 17:42:40 2000 +++ linux-2.4.0-test7-pre5.acme/drivers/scsi/eata_dma.c Tue Aug 22 08:14:16 2000 @@ -59,6 +59,7 @@ * of bugs during the development. * ************************************************************ * last change: 96/10/21 OS: Linux 2.0.23 * + * 00/08/22 OS: Linux 2.4.0-test7-pre5 * ************************************************************/ /* Look in eata_dma.h for configuration and revision information */ @@ -909,8 +910,14 @@ cp = (struct eata_ccb *) kmalloc(sizeof(struct eata_ccb), GFP_ATOMIC | GFP_DMA); + if (!cp) + return NULL; sp = (struct eata_sp *) kmalloc(sizeof(struct eata_sp), GFP_ATOMIC | GFP_DMA); + if (!sp) { + kfree(cp); + return NULL; + } buff = dma_scratch; @@ -1445,7 +1452,7 @@ } } #endif /* #ifndef CONFIG_PCI */ -} + } int eata_detect(Scsi_Host_Template * tpnt) { @@ -1459,10 +1466,15 @@ tpnt->proc_name = "eata_dma"; status = kmalloc(512, GFP_ATOMIC | GFP_DMA); - dma_scratch = kmalloc(1024, GFP_ATOMIC | GFP_DMA); + if (!status) { + printk("eata_dma: can't allocate enough memory to probe for hosts!\n"); + return 0; + } - if(status == NULL || dma_scratch == NULL) { - printk("eata_dma: can't allocate enough memory to probe for hosts !\n"); + dma_scratch = kmalloc(1024, GFP_ATOMIC | GFP_DMA); + if(!dma_scratch) { + printk("eata_dma: can't allocate enough memory to probe for hosts!\n"); + kfree(status); return(0); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |