From 44777f8dc123955fafb256d02d9d78024e23efc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Wed, 3 Apr 2024 17:13:56 +0100 Subject: [PATCH] Fix NULL dereference in dev_c7200_pa_mc8te1_init. Fixes #118 --- common/dev_pa_mc8te1.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/dev_pa_mc8te1.c b/common/dev_pa_mc8te1.c index 25d397065..a0b0da7a4 100644 --- a/common/dev_pa_mc8te1.c +++ b/common/dev_pa_mc8te1.c @@ -268,6 +268,10 @@ int dev_c7200_pa_mc8te1_init(vm_instance_t *vm,struct cisco_card *card) d->plx_obj = dev_plx9054_init(vm,d->plx_name, card->pci_bus,1, &d->ssram_dev,NULL); + if (d->plx_obj == NULL) { + dev_c7200_pa_mc8te1_shutdown(vm, card); + return(-1); + } /* Set callback function for PLX9054 PCI-To-Local doorbell */ dev_plx_set_pci2loc_doorbell_cbk(d->plx_obj->data,