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
This commit is contained in:
@@ -105,8 +105,7 @@ static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
strncpy(mce_helper, buf, sizeof(mce_helper));
|
strscpy(mce_helper, buf, sizeof(mce_helper));
|
||||||
mce_helper[sizeof(mce_helper)-1] = 0;
|
|
||||||
p = strchr(mce_helper, '\n');
|
p = strchr(mce_helper, '\n');
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
|
|||||||
@@ -138,15 +138,12 @@ static __init int add_rtc_cmos(void)
|
|||||||
static const char * const ids[] __initconst =
|
static const char * const ids[] __initconst =
|
||||||
{ "PNP0b00", "PNP0b01", "PNP0b02", };
|
{ "PNP0b00", "PNP0b01", "PNP0b02", };
|
||||||
struct pnp_dev *dev;
|
struct pnp_dev *dev;
|
||||||
struct pnp_id *id;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pnp_for_each_dev(dev) {
|
pnp_for_each_dev(dev) {
|
||||||
for (id = dev->id; id; id = id->next) {
|
for (i = 0; i < ARRAY_SIZE(ids); i++) {
|
||||||
for (i = 0; i < ARRAY_SIZE(ids); i++) {
|
if (compare_pnp_id(dev->id, ids[i]) != 0)
|
||||||
if (compare_pnp_id(id, ids[i]) != 0)
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user