Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157027961
D38455.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D38455.id.diff
View Options
diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c
--- a/sys/powerpc/powerpc/intr_machdep.c
+++ b/sys/powerpc/powerpc/intr_machdep.c
@@ -127,6 +127,7 @@
#endif
static u_int stray_count;
+#define INTRNAME_LEN (MAXCOMLEN + 1)
u_long *intrcnt;
char *intrnames;
size_t sintrcnt = sizeof(intrcnt);
@@ -152,8 +153,8 @@
intrcnt_setname(const char *name, int index)
{
- snprintf(intrnames + (MAXCOMLEN + 1) * index, MAXCOMLEN + 1, "%-*s",
- MAXCOMLEN, name);
+ snprintf(intrnames + INTRNAME_LEN * index, INTRNAME_LEN, "%-*s",
+ INTRNAME_LEN - 1, name);
}
static void
@@ -177,10 +178,10 @@
#endif
intrcnt = mallocarray(nintrcnt, sizeof(u_long), M_INTR, M_WAITOK |
M_ZERO);
- intrnames = mallocarray(nintrcnt, MAXCOMLEN + 1, M_INTR, M_WAITOK |
+ intrnames = mallocarray(nintrcnt, INTRNAME_LEN, M_INTR, M_WAITOK |
M_ZERO);
sintrcnt = nintrcnt * sizeof(u_long);
- sintrnames = nintrcnt * (MAXCOMLEN + 1);
+ sintrnames = nintrcnt * INTRNAME_LEN;
intrcnt_setname("???", 0);
intrcnt_index = 1;
diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c
--- a/sys/x86/x86/intr_machdep.c
+++ b/sys/x86/x86/intr_machdep.c
@@ -93,6 +93,7 @@
static int assign_cpu;
#endif
+#define INTRNAME_LEN (MAXCOMLEN + 1)
u_long *intrcnt;
char *intrnames;
size_t sintrcnt = sizeof(intrcnt);
@@ -187,10 +188,10 @@
#endif
intrcnt = mallocarray(nintrcnt, sizeof(u_long), M_INTR, M_WAITOK |
M_ZERO);
- intrnames = mallocarray(nintrcnt, MAXCOMLEN + 1, M_INTR, M_WAITOK |
+ intrnames = mallocarray(nintrcnt, INTRNAME_LEN, M_INTR, M_WAITOK |
M_ZERO);
sintrcnt = nintrcnt * sizeof(u_long);
- sintrnames = nintrcnt * (MAXCOMLEN + 1);
+ sintrnames = nintrcnt * INTRNAME_LEN;
intrcnt_setname("???", 0);
intrcnt_index = 1;
@@ -428,8 +429,8 @@
intrcnt_setname(const char *name, int index)
{
- snprintf(intrnames + (MAXCOMLEN + 1) * index, MAXCOMLEN + 1, "%-*s",
- MAXCOMLEN, name);
+ snprintf(intrnames + INTRNAME_LEN * index, INTRNAME_LEN, "%-*s",
+ INTRNAME_LEN - 1, name);
}
static void
@@ -442,14 +443,14 @@
static void
intrcnt_register(struct intsrc *is)
{
- char straystr[MAXCOMLEN + 1];
+ char straystr[INTRNAME_LEN];
KASSERT(is->is_event != NULL, ("%s: isrc with no event", __func__));
mtx_lock_spin(&intrcnt_lock);
MPASS(intrcnt_index + 2 <= nintrcnt);
is->is_index = intrcnt_index;
intrcnt_index += 2;
- snprintf(straystr, MAXCOMLEN + 1, "stray irq%d",
+ snprintf(straystr, sizeof(straystr), "stray irq%d",
is->is_pic->pic_vector(is));
intrcnt_updatename(is);
is->is_count = &intrcnt[is->is_index];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 19, 12:52 AM (3 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33281037
Default Alt Text
D38455.id.diff (2 KB)
Attached To
Mode
D38455: sys/intr: merge interrupt table uses of MAXCOMLEN into INTRNAME_LEN
Attached
Detach File
Event Timeline
Log In to Comment