All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Xin <wangxin410@huawei.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] controllers/cpuset: Fix bug for type of variable c in checkopt
Date: Wed, 7 Apr 2021 15:50:08 +0800	[thread overview]
Message-ID: <1617781808-82555-1-git-send-email-wangxin410@huawei.com> (raw)

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


             reply	other threads:[~2021-04-07  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  7:50 Wang Xin [this message]
2021-04-14  7:29 ` [LTP] [PATCH] controllers/cpuset: Fix bug for type of variable c in checkopt Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617781808-82555-1-git-send-email-wangxin410@huawei.com \
    --to=wangxin410@huawei.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.