aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/megasas.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-06-30 11:10:41 -0400
committerKevin O'Connor <kevin@koconnor.net>2015-07-04 14:23:01 -0400
commit3abdc7c018c727b96549930d2929623ca381fff7 (patch)
tree27ff8afdb34f608875fc0fa5edf9a81ab94a4354 /src/hw/megasas.c
parent1202f03583f3b8b46e2de6b82630054d53e24801 (diff)
downloadseabios-3abdc7c018c727b96549930d2929623ca381fff7.tar.gz
Make sure all code checks for malloc failures
This is the result of an audit of callers of the malloc_XXX() and memalign_XXX() calls. All callers need to check if these functions return NULL. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw/megasas.c')
-rw-r--r--src/hw/megasas.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hw/megasas.c b/src/hw/megasas.c
index b2a65e48..66779778 100644
--- a/src/hw/megasas.c
+++ b/src/hw/megasas.c
@@ -241,7 +241,10 @@ static void megasas_scan_target(struct pci_device *pci, u32 iobase)
{
struct mfi_ld_list_s ld_list;
struct megasas_cmd_frame *frame = memalign_tmp(256, sizeof(*frame));
- int i;
+ if (!frame) {
+ warn_noalloc();
+ return;
+ }
memset(&ld_list, 0, sizeof(ld_list));
memset_fl(frame, 0, sizeof(*frame));
@@ -258,6 +261,7 @@ static void megasas_scan_target(struct pci_device *pci, u32 iobase)
if (megasas_fire_cmd(pci->device, iobase, frame) == 0) {
dprintf(2, "%d LD found\n", ld_list.count);
+ int i;
for (i = 0; i < ld_list.count; i++) {
dprintf(2, "LD %d:%d state 0x%x\n",
ld_list.lds[i].target, ld_list.lds[i].lun,