lkml.org 
[lkml]   [2020]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 10/24] x86/resctrl: Move the schema names into struct resctrl_schema
From
Date
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

\
 
 \ /
  Last update: 2020-11-11 19:12    [W:1.998 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site