[LTP] [PATCH] lib: use braces instead of NULL for struct arrary ending
Li Wang
liwang@redhat.com
Thu Mar 10 10:22:27 CET 2022
Reported-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Li Wang <liwang@redhat.com>
---
doc/c-test-api.txt | 2 +-
include/tst_test.h | 6 +++---
lib/newlib_tests/test19.c | 2 +-
lib/newlib_tests/test20.c | 2 +-
testcases/cve/icmp_rate_limit01.c | 2 +-
testcases/kernel/containers/userns/userns08.c | 2 +-
testcases/kernel/mem/ksm/ksm01.c | 2 +-
testcases/kernel/mem/ksm/ksm02.c | 2 +-
testcases/kernel/mem/ksm/ksm03.c | 2 +-
testcases/kernel/mem/ksm/ksm04.c | 2 +-
testcases/kernel/mem/ksm/ksm05.c | 2 +-
testcases/kernel/mem/ksm/ksm06.c | 2 +-
testcases/kernel/syscalls/add_key/add_key05.c | 2 +-
testcases/kernel/syscalls/bind/bind06.c | 2 +-
testcases/kernel/syscalls/madvise/madvise08.c | 2 +-
testcases/kernel/syscalls/migrate_pages/migrate_pages02.c | 2 +-
testcases/kernel/syscalls/sendto/sendto03.c | 2 +-
testcases/kernel/syscalls/setsockopt/setsockopt05.c | 2 +-
testcases/kernel/syscalls/setsockopt/setsockopt06.c | 2 +-
testcases/kernel/syscalls/setsockopt/setsockopt07.c | 2 +-
testcases/kernel/syscalls/setsockopt/setsockopt08.c | 2 +-
testcases/kernel/syscalls/setsockopt/setsockopt09.c | 2 +-
22 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/doc/c-test-api.txt b/doc/c-test-api.txt
index 915255176..9f104ecd7 100644
--- a/doc/c-test-api.txt
+++ b/doc/c-test-api.txt
@@ -1582,7 +1582,7 @@ Pathnames can be optionally prefixed to specify how strictly (during
-------------------------------------------------------------------------------
static const struct tst_path_val save_restore[] = {
{"/proc/sys/kernel/core_pattern", NULL},
- NULL,
+ {}
};
static void setup(void)
diff --git a/include/tst_test.h b/include/tst_test.h
index 3bedcc707..dbe303bc8 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -256,7 +256,7 @@ struct tst_test {
const char * const *needs_drivers;
/*
- * NULL terminated array of (/proc, /sys) files to save
+ * {NULL, NULL} terminated array of (/proc, /sys) files to save
* before setup and restore after cleanup
*/
const struct tst_path_val *save_restore;
@@ -268,12 +268,12 @@ struct tst_test {
const char *const *needs_kconfigs;
/*
- * NULL-terminated array to be allocated buffers.
+ * {NULL, NULL} terminated array to be allocated buffers.
*/
struct tst_buffers *bufs;
/*
- * NULL-terminated array of capability settings
+ * {NULL, NULL} terminated array of capability settings
*/
struct tst_cap *caps;
diff --git a/lib/newlib_tests/test19.c b/lib/newlib_tests/test19.c
index 4359a58ea..2ba66d745 100644
--- a/lib/newlib_tests/test19.c
+++ b/lib/newlib_tests/test19.c
@@ -27,6 +27,6 @@ static struct tst_test test = {
{"?/proc/nonexistent", NULL},
{"!/proc/sys/kernel/numa_balancing", NULL},
{"/proc/sys/kernel/core_pattern", NULL},
- NULL,
+ {}
},
};
diff --git a/lib/newlib_tests/test20.c b/lib/newlib_tests/test20.c
index aaa424c83..5c24770a1 100644
--- a/lib/newlib_tests/test20.c
+++ b/lib/newlib_tests/test20.c
@@ -38,6 +38,6 @@ static struct tst_test test = {
.request_hugepages = 2,
.save_restore = (const struct tst_path_val[]) {
{"!/proc/sys/kernel/numa_balancing", "0"},
- NULL,
+ {}
},
};
diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c
index b8f159514..1263762d2 100644
--- a/testcases/cve/icmp_rate_limit01.c
+++ b/testcases/cve/icmp_rate_limit01.c
@@ -270,7 +270,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "b38e7819cae9"},
diff --git a/testcases/kernel/containers/userns/userns08.c b/testcases/kernel/containers/userns/userns08.c
index 822b5c93f..bde944f22 100644
--- a/testcases/kernel/containers/userns/userns08.c
+++ b/testcases/kernel/containers/userns/userns08.c
@@ -136,7 +136,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "d2f007dbe7e4"},
diff --git a/testcases/kernel/mem/ksm/ksm01.c b/testcases/kernel/mem/ksm/ksm01.c
index 4265f7486..1f3852fc3 100644
--- a/testcases/kernel/mem/ksm/ksm01.c
+++ b/testcases/kernel/mem/ksm/ksm01.c
@@ -84,7 +84,7 @@ static struct tst_test test = {
{"!/sys/kernel/mm/ksm/sleep_millisecs", NULL},
{"?/sys/kernel/mm/ksm/max_page_sharing", NULL},
{"?/sys/kernel/mm/ksm/merge_across_nodes", "1"},
- NULL,
+ {}
},
.needs_kconfigs = (const char *const[]){
"CONFIG_KSM=y",
diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
index daa8eb076..1cb7d8e73 100644
--- a/testcases/kernel/mem/ksm/ksm02.c
+++ b/testcases/kernel/mem/ksm/ksm02.c
@@ -102,7 +102,7 @@ static struct tst_test test = {
{"!/sys/kernel/mm/ksm/sleep_millisecs", NULL},
{"?/sys/kernel/mm/ksm/max_page_sharing", NULL},
{"?/sys/kernel/mm/ksm/merge_across_nodes", "1"},
- NULL,
+ {}
},
.needs_kconfigs = (const char *const[]){
"CONFIG_KSM=y",
diff --git a/testcases/kernel/mem/ksm/ksm03.c b/testcases/kernel/mem/ksm/ksm03.c
index f0115eb18..1cf2e4954 100644
--- a/testcases/kernel/mem/ksm/ksm03.c
+++ b/testcases/kernel/mem/ksm/ksm03.c
@@ -87,7 +87,7 @@ static struct tst_test test = {
{"!/sys/kernel/mm/ksm/sleep_millisecs", NULL},
{"?/sys/kernel/mm/ksm/max_page_sharing", NULL},
{"?/sys/kernel/mm/ksm/merge_across_nodes", "1"},
- NULL,
+ {}
},
.needs_kconfigs = (const char *const[]){
"CONFIG_KSM=y",
diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
index ec058aa01..39c741876 100644
--- a/testcases/kernel/mem/ksm/ksm04.c
+++ b/testcases/kernel/mem/ksm/ksm04.c
@@ -104,7 +104,7 @@ static struct tst_test test = {
{"!/sys/kernel/mm/ksm/sleep_millisecs", NULL},
{"?/sys/kernel/mm/ksm/max_page_sharing", NULL},
{"?/sys/kernel/mm/ksm/merge_across_nodes", "1"},
- NULL,
+ {}
},
.needs_kconfigs = (const char *const[]){
"CONFIG_KSM=y",
diff --git a/testcases/kernel/mem/ksm/ksm05.c b/testcases/kernel/mem/ksm/ksm05.c
index 0c1ced5d7..146a9a3b7 100644
--- a/testcases/kernel/mem/ksm/ksm05.c
+++ b/testcases/kernel/mem/ksm/ksm05.c
@@ -90,7 +90,7 @@ static struct tst_test test = {
.min_kver = "2.6.32",
.save_restore = (const struct tst_path_val[]) {
{"!/sys/kernel/mm/ksm/run", "1"},
- NULL,
+ {}
},
.needs_kconfigs = (const char *const[]){
"CONFIG_KSM=y",
diff --git a/testcases/kernel/mem/ksm/ksm06.c b/testcases/kernel/mem/ksm/ksm06.c
index 4f39be0b2..21c82edc1 100644
--- a/testcases/kernel/mem/ksm/ksm06.c
+++ b/testcases/kernel/mem/ksm/ksm06.c
@@ -141,7 +141,7 @@ static struct tst_test test = {
{"!/sys/kernel/mm/ksm/run", NULL},
{"!/sys/kernel/mm/ksm/sleep_millisecs", NULL},
{"/sys/kernel/mm/ksm/merge_across_nodes", NULL},
- NULL,
+ {}
},
.needs_kconfigs = (const char *const[]){
"CONFIG_KSM=y",
diff --git a/testcases/kernel/syscalls/add_key/add_key05.c b/testcases/kernel/syscalls/add_key/add_key05.c
index 7a9cc6453..71a88d1a8 100644
--- a/testcases/kernel/syscalls/add_key/add_key05.c
+++ b/testcases/kernel/syscalls/add_key/add_key05.c
@@ -218,7 +218,7 @@ static struct tst_test test = {
{"?/proc/sys/kernel/keys/gc_delay", "1"},
{"?/proc/sys/kernel/keys/maxkeys", "200"},
{"?/proc/sys/kernel/keys/maxbytes", "20000"},
- NULL,
+ {}
},
.bufs = (struct tst_buffers []) {
{&user_buf, .size = 64},
diff --git a/testcases/kernel/syscalls/bind/bind06.c b/testcases/kernel/syscalls/bind/bind06.c
index d0157d426..1dfc534a7 100644
--- a/testcases/kernel/syscalls/bind/bind06.c
+++ b/testcases/kernel/syscalls/bind/bind06.c
@@ -111,7 +111,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "15fe076edea7"},
diff --git a/testcases/kernel/syscalls/madvise/madvise08.c b/testcases/kernel/syscalls/madvise/madvise08.c
index b774bcd1c..30f360449 100644
--- a/testcases/kernel/syscalls/madvise/madvise08.c
+++ b/testcases/kernel/syscalls/madvise/madvise08.c
@@ -215,6 +215,6 @@ static struct tst_test test = {
.forks_child = 1,
.save_restore = (const struct tst_path_val[]) {
{CORE_PATTERN, NULL},
- NULL,
+ {}
},
};
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
index 7552464b8..32da57042 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
@@ -328,7 +328,7 @@ static struct tst_test test = {
.setup = setup,
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/kernel/numa_balancing", "0"},
- NULL,
+ {}
},
};
#else
diff --git a/testcases/kernel/syscalls/sendto/sendto03.c b/testcases/kernel/syscalls/sendto/sendto03.c
index aa4dc3040..5d2c1e112 100644
--- a/testcases/kernel/syscalls/sendto/sendto03.c
+++ b/testcases/kernel/syscalls/sendto/sendto03.c
@@ -219,7 +219,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "bcc5364bdcfe"},
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt05.c b/testcases/kernel/syscalls/setsockopt/setsockopt05.c
index d7855cfab..651583fb6 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt05.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt05.c
@@ -103,7 +103,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "85f1bd9a7b5a"},
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt06.c b/testcases/kernel/syscalls/setsockopt/setsockopt06.c
index e4c2671c0..c6fc2fba9 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt06.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt06.c
@@ -131,7 +131,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "84ac7260236a"},
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt07.c b/testcases/kernel/syscalls/setsockopt/setsockopt07.c
index 49c8fb6b4..147ae3899 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt07.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt07.c
@@ -143,7 +143,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "c27927e372f0"},
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt08.c b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
index 864958b3e..563444635 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt08.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
@@ -160,7 +160,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "b29c457a6511"},
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt09.c b/testcases/kernel/syscalls/setsockopt/setsockopt09.c
index 4f03975ca..4b1ce2e92 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt09.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt09.c
@@ -107,7 +107,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{"?/proc/sys/user/max_user_namespaces", NULL},
- NULL,
+ {}
},
.tags = (const struct tst_tag[]) {
{"linux-git", "ec6af094ea28"},
--
2.31.1
More information about the ltp
mailing list