Skip to content

Commit e0f184b

Browse files
oohalstewartsmith
authored andcommitted
platform: set default bmc_platform
The bmc_platform pointer is set to NULL by default and on non-AMI BMC platforms. As a result a few places in hw/ipmi/ipmi-sel.c will blindly dereference a NULL pointer. This patch sets the default value for bmc_platform to generic_bmc to avoid this. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent 3f7b42a commit e0f184b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/platform.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
bool manufacturing_mode = false;
3030
struct platform platform;
31-
const struct bmc_platform *bmc_platform = NULL;
3231

3332
DEFINE_LOG_ENTRY(OPAL_RC_ABNORMAL_REBOOT, OPAL_PLATFORM_ERR_EVT, OPAL_CEC,
3433
OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_FAULT_RECTIFY_REBOOT,
@@ -143,10 +142,15 @@ static struct platform generic_platform = {
143142
.cec_power_down = generic_cec_power_down,
144143
};
145144

145+
const struct bmc_platform *bmc_platform = &generic_bmc;
146+
146147
void set_bmc_platform(const struct bmc_platform *bmc)
147148
{
148149
if (bmc)
149150
prlog(PR_NOTICE, "PLAT: Detected BMC platform %s\n", bmc->name);
151+
else
152+
bmc = &generic_bmc;
153+
150154
bmc_platform = bmc;
151155
}
152156

0 commit comments

Comments
 (0)