From ac70245e9a8a83ddd584564759d77fba97bbd42c Mon Sep 17 00:00:00 2001 From: "Huawei Technologies Co., Ltd" Date: Tue, 3 Nov 2020 17:42:56 +0800 Subject: [PATCH] block/vvfat: Fix bad printf format specifiers We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". In addition, fix two error format problems found by checkpatch.pl: ERROR: space required after that ',' (ctx:VxV) + fprintf(stderr,"%s attributes=0x%02x begin=%u size=%d\n", ^ ERROR: line over 90 characters + fprintf(stderr, "%d, %s (%u, %d)\n", i, commit->path ? commit->path : "(null)", commit->param.rename.cluster, commit->action); Reported-by: Euler Robot Signed-off-by: Alex Chen Message-Id: <5FA12620.6030705@huawei.com> Signed-off-by: Kevin Wolf (cherry-picked from commit c9eb2f3e38) --- ...fat-Fix-bad-printf-format-specifiers.patch | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 block-vvfat-Fix-bad-printf-format-specifiers.patch diff --git a/block-vvfat-Fix-bad-printf-format-specifiers.patch b/block-vvfat-Fix-bad-printf-format-specifiers.patch new file mode 100644 index 0000000..597b978 --- /dev/null +++ b/block-vvfat-Fix-bad-printf-format-specifiers.patch @@ -0,0 +1,77 @@ +From c9a4e85610bffe1803648c431e4cff4539a42323 Mon Sep 17 00:00:00 2001 +From: AlexChen +Date: Tue, 3 Nov 2020 17:42:56 +0800 +Subject: [PATCH] block/vvfat: Fix bad printf format specifiers + +We should use printf format specifier "%u" instead of "%d" for +argument of type "unsigned int". +In addition, fix two error format problems found by checkpatch.pl: +ERROR: space required after that ',' (ctx:VxV) ++ fprintf(stderr,"%s attributes=0x%02x begin=%u size=%d\n", + ^ +ERROR: line over 90 characters ++ fprintf(stderr, "%d, %s (%u, %d)\n", i, commit->path ? commit->path : "(null)", commit->param.rename.cluster, commit->action); + +Reported-by: Euler Robot +Signed-off-by: Alex Chen +Message-Id: <5FA12620.6030705@huawei.com> +Signed-off-by: Kevin Wolf +(cherry-picked from commit c9eb2f3e38) +--- + block/vvfat.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/block/vvfat.c b/block/vvfat.c +index f6c28805dd..5dc8d6eb4c 100644 +--- a/block/vvfat.c ++++ b/block/vvfat.c +@@ -1453,7 +1453,7 @@ static void print_direntry(const direntry_t* direntry) + for(i=0;i<11;i++) + ADD_CHAR(direntry->name[i]); + buffer[j] = 0; +- fprintf(stderr,"%s attributes=0x%02x begin=%d size=%d\n", ++ fprintf(stderr, "%s attributes=0x%02x begin=%u size=%u\n", + buffer, + direntry->attributes, + begin_of_direntry(direntry),le32_to_cpu(direntry->size)); +@@ -1462,7 +1462,7 @@ static void print_direntry(const direntry_t* direntry) + + static void print_mapping(const mapping_t* mapping) + { +- fprintf(stderr, "mapping (%p): begin, end = %d, %d, dir_index = %d, " ++ fprintf(stderr, "mapping (%p): begin, end = %u, %u, dir_index = %u, " + "first_mapping_index = %d, name = %s, mode = 0x%x, " , + mapping, mapping->begin, mapping->end, mapping->dir_index, + mapping->first_mapping_index, mapping->path, mapping->mode); +@@ -1470,7 +1470,7 @@ static void print_mapping(const mapping_t* mapping) + if (mapping->mode & MODE_DIRECTORY) + fprintf(stderr, "parent_mapping_index = %d, first_dir_index = %d\n", mapping->info.dir.parent_mapping_index, mapping->info.dir.first_dir_index); + else +- fprintf(stderr, "offset = %d\n", mapping->info.file.offset); ++ fprintf(stderr, "offset = %u\n", mapping->info.file.offset); + } + #endif + +@@ -1604,7 +1604,7 @@ typedef struct commit_t { + static void clear_commits(BDRVVVFATState* s) + { + int i; +-DLOG(fprintf(stderr, "clear_commits (%d commits)\n", s->commits.next)); ++DLOG(fprintf(stderr, "clear_commits (%u commits)\n", s->commits.next)); + for (i = 0; i < s->commits.next; i++) { + commit_t* commit = array_get(&(s->commits), i); + assert(commit->path || commit->action == ACTION_WRITEOUT); +@@ -2660,7 +2660,9 @@ static int handle_renames_and_mkdirs(BDRVVVFATState* s) + fprintf(stderr, "handle_renames\n"); + for (i = 0; i < s->commits.next; i++) { + commit_t* commit = array_get(&(s->commits), i); +- fprintf(stderr, "%d, %s (%d, %d)\n", i, commit->path ? commit->path : "(null)", commit->param.rename.cluster, commit->action); ++ fprintf(stderr, "%d, %s (%u, %d)\n", i, ++ commit->path ? commit->path : "(null)", ++ commit->param.rename.cluster, commit->action); + } + #endif + +-- +2.27.0 +