Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148170185
D14790.id40578.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D14790.id40578.diff
View Options
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");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 17, 6:14 AM (2 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29811484
Default Alt Text
D14790.id40578.diff (1 KB)
Attached To
Mode
D14790: jedec_dimm: Use correct string length when populating sc->slotid_str
Attached
Detach File
Event Timeline
Log In to Comment