All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] controllers/cpuset: Fix bug for type of variable c in checkopt
@ 2021-04-07  7:50 Wang Xin
  2021-04-14  7:29 ` Li Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Xin @ 2021-04-07  7:50 UTC (permalink / raw)
  To: ltp

This is the result of running the cpuset_load_balance test case on the ARM64 physical machine:
cpuset_load_balance 1 TFAIL: There is something wrong with test tasks
...
cpuset_load_balance 3 TFAIL: There is something wrong with test tasks
...
cpuset_load_balance 5 TFAIL: There is something wrong with test tasks
...
The analysis shows that on the ARM64-based machine, the getopt performs a while operation.
In addition, the value of char is 0 instead of 1 when it is extended to the left during comparison with the integer type,
resulting in a failure at while ((c = getopt(argc, argv, "p:h")) != -1).
Change the type of variable c to int to fix the problem.

Signed-off-by: Wang Xin <wangxin410@huawei.com>
---
 .../kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c b/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c
index 8a6ec26..125ebd1 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c
@@ -111,7 +111,7 @@ void usage(char *prog_name, int status)
 void checkopt(int argc, char **argv)
 {
-	char c = '\0';
+	int c = '\0';
 	char *endptr = NULL;
 	long nr_cpus = 0;
 	long opt_value = 0;
2.6.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [LTP] [PATCH] controllers/cpuset: Fix bug for type of variable c in checkopt
  2021-04-07  7:50 [LTP] [PATCH] controllers/cpuset: Fix bug for type of variable c in checkopt Wang Xin
@ 2021-04-14  7:29 ` Li Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Li Wang @ 2021-04-14  7:29 UTC (permalink / raw)
  To: ltp

Patch applied, thanks for fix this issue.

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210414/934ce710/attachment.htm>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-14  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  7:50 [LTP] [PATCH] controllers/cpuset: Fix bug for type of variable c in checkopt Wang Xin
2021-04-14  7:29 ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.