Skip to content

Commit 89f5349

Browse files
committed
Merge tag 'x86-platform-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 platform update from Ingo Molnar: - Simplify add_rtc_cmos() - Use strscpy() in the mcelog code * tag 'x86-platform-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mce/dev-mcelog: use strscpy() to instead of strncpy() x86/rtc: Simplify PNP ids check
2 parents 238b05e + 7ddf005 commit 89f5349

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

arch/x86/kernel/cpu/mce/dev-mcelog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
105105
{
106106
char *p;
107107

108-
strncpy(mce_helper, buf, sizeof(mce_helper));
109-
mce_helper[sizeof(mce_helper)-1] = 0;
108+
strscpy(mce_helper, buf, sizeof(mce_helper));
110109
p = strchr(mce_helper, '\n');
111110

112111
if (p)

arch/x86/kernel/rtc.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,12 @@ static __init int add_rtc_cmos(void)
138138
static const char * const ids[] __initconst =
139139
{ "PNP0b00", "PNP0b01", "PNP0b02", };
140140
struct pnp_dev *dev;
141-
struct pnp_id *id;
142141
int i;
143142

144143
pnp_for_each_dev(dev) {
145-
for (id = dev->id; id; id = id->next) {
146-
for (i = 0; i < ARRAY_SIZE(ids); i++) {
147-
if (compare_pnp_id(id, ids[i]) != 0)
148-
return 0;
149-
}
144+
for (i = 0; i < ARRAY_SIZE(ids); i++) {
145+
if (compare_pnp_id(dev->id, ids[i]) != 0)
146+
return 0;
150147
}
151148
}
152149
#endif

0 commit comments

Comments
 (0)