diff --git a/unified-sel.c b/unified-sel.c index 564afca..d0a94b1 100644 --- a/unified-sel.c +++ b/unified-sel.c @@ -51,14 +51,17 @@ static int verify_id_log_sel(uint64_t status, * Byte 16: ID of the error detected on the PCle device that triggered this SEL record */ - /* Potentially all error status bits could be set for a given PCIe device. - * Therefore, iterate over all 32 bits each of cor and uncor errors + /* + * Potentially all error status bits could be set for a given PCIe + * device. Therefore, iterate over all 32 bits each of cor and uncor + * errors. */ for (i = 0; i < 32; i++) { if ((status & (1 << i)) && idarray[i]) { - sprintf(openbmc_ipmi_add_sel, - "ipmitool raw 0x0a 0x44 0x00 0x00 0xFB 0x20 0x00 0x00 0x00 0x00 0x01 0x00 0x%02x 0x%02x 0x01 0x00 0xff %s", - dev_fn, bus, idarray[i]); + snprintf(openbmc_ipmi_add_sel, + sizeof(openbmc_ipmi_add_sel), + "ipmitool raw 0x0a 0x44 0x00 0x00 0xFB 0x20 0x00 0x00 0x00 0x00 0x01 0x00 0x%02x 0x%02x 0x01 0x00 0xff %s", + dev_fn, bus, idarray[i]); if (system(openbmc_ipmi_add_sel) != 0) return -1; } @@ -73,9 +76,10 @@ int openbmc_unified_sel_log(uint64_t severity, const char *dev_name, uint64_t st sscanf(dev_name, "%*x:%x:%x.%x", &bus, &dev, &fn); dev_fn = (((dev & 0x1f) << 3) | (fn & 0x7)); - /* Use the appropriate correctable error status ID + /* + * Use the appropriate correctable error status ID * for a given severity level - * */ + */ if (severity == HW_EVENT_AER_CORRECTED) { if (verify_id_log_sel(status, cor_error_ids, bus, dev_fn) < 0) return -1;