[LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute

Cristian Marussi cristian.marussi@arm.com
Wed Nov 14 15:39:14 CET 2018


Hi

On 14/11/2018 14:32, Cyril Hrubis wrote:
> Hi!
>> cpuset_hotplug failed with:
>>
>> Usage : cpuset_list_compute [-a|s] list1 [list2]
>>
>>          -a|s   list1 add/subtract list2.[default: -a]
>>
>>          -h     Help.
>> cpuset_hotplug 1 TFAIL: root group's cpus isn't expected(Result: 0,2-5, Expect: ).
>>
>> It turned out that helper cpuset_list_compute was always failing because it was
>> improperly handling getopt retval.
> 
> It's working on intel, but I suppose that it overflows on arm since char
> is smaller than int there. It would be a bit better if something along
> these lines was written here. Otherwise the patch itself looks good.
> 

Fine I will add some more explanation.

Thanks

Cristian

>> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
>> ---
>>   .../cpuset/cpuset_hotplug_test/cpuset_list_compute.c           | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
>> index 1b55f4b30..b9f176af4 100644
>> --- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
>> +++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
>> @@ -29,8 +29,7 @@ static void usage(char *prog_name, int status)
>>   
>>   static void checkopt(int argc, char **argv)
>>   {
>> -	char c = '\0';
>> -	int optc = 0;
>> +	int c, optc = 0;
>>   
>>   	while ((c = getopt(argc, argv, "ahs")) != -1) {
>>   		switch (c) {
>> -- 
>> 2.17.1
>>
>>
>> -- 
>> Mailing list info: https://lists.linux.it/listinfo/ltp
> 



More information about the ltp mailing list