[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 11 Nov 2020 18:11:21 +0000
From: James Morse <james.morse@....com>
To: Jamie Iles <jamie@...iainc.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
shameerali.kolothum.thodi@...wei.com,
D Scott Phillips OS <scott@...amperecomputing.com>
Subject: Re: [PATCH 10/24] x86/resctrl: Move the schema names into struct
resctrl_schema
Hi Jamie,
Thanks for taking a look,
On 10/11/2020 11:39, Jamie Iles wrote:
> On Fri, Oct 30, 2020 at 04:11:06PM +0000, James Morse wrote:
>> Move the names used for the schemata file out of the resource and
>> into struct resctrl_schema. This allows one resource to have two
>> different names, based on the other schema properties.
>>
>> This patch copies the names, eventually resctrl will generate them.
>>
>> Remove the arch code's max_name_width, this is now resctrl's
>> problem.
>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> index 311a3890bc53..48f4d6783647 100644
>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> @@ -2150,6 +2151,12 @@ static int create_schemata_list(void)
>> s->num_closid = resctrl_arch_get_num_closid(r);
>> s->conf_type = resctrl_to_arch_res(r)->conf_type;
>>
>> + ret = snprintf(s->name, sizeof(s->name), r->name);
>> + if (ret >= sizeof(s->name)) {
>> + kfree(s);
>> + return -EINVAL;
>> + }
>> +
>
> How about:
>
> + ret = strscpy(s->name, r->name, sizeof(s->name));
> + if (ret < 0)) {
> + kfree(s);
> + return -EINVAL;
> + }
Never heard of it ... yup, that looks better. Thanks!
(I thought I knew not to write that bug!)
> So that there isn't a non-constant format specifier that'll trip
> Coverity+friends up later?
Heh, its gone by the last patch.
Fixed locally.
Thanks,
James
Powered by blists - more mailing lists