Index: sys/dev/jedec_dimm/jedec_dimm.c =================================================================== --- sys/dev/jedec_dimm/jedec_dimm.c +++ sys/dev/jedec_dimm/jedec_dimm.c @@ -192,6 +192,7 @@ int rc; int new_desc_len; enum dram_type type; + size_t slotid_str_size; struct jedec_dimm_softc *sc; struct sysctl_ctx_list *ctx; struct sysctl_oid *oid; @@ -338,13 +339,14 @@ } /* If a "slotid" was hinted, add the sysctl for it. */ + slotid_str_size = 0; if (resource_string_value(device_get_name(dev), device_get_unit(dev), "slotid", &slotid_str) == 0) { if (slotid_str != NULL) { - sc->slotid_str = malloc(strlen(slotid_str) + 1, - M_DEVBUF, (M_WAITOK | M_ZERO)); - strlcpy(sc->slotid_str, slotid_str, - sizeof(sc->slotid_str)); + slotid_str_size = strlen(slotid_str) + 1; + sc->slotid_str = malloc(slotid_str_size, M_DEVBUF, + M_WAITOK); + strlcpy(sc->slotid_str, slotid_str, slotid_str_size); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "slotid", CTLFLAG_RD | CTLFLAG_MPSAFE, sc->slotid_str, 0, "DIMM Slot Identifier");