CC: [email protected]
TO: Jaegeuk Kim <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git 
linux-4.19.y
head:   e1712134c01acfde2d20aea490ad3b3581ec8e0a
commit: 56427c9cf549342906953cfd1d180d014b78c97b [303/666] unicode: introduce 
test module for normalized utf8 implementation
:::::: branch date: 3 days ago
:::::: commit date: 12 months ago
compiler: alpha-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


cppcheck warnings: (new ones prefixed by >>)

>> fs/unicode/utf8-selftest.c:190:3: warning: Conversion of string literal "" 
>> to bool always evaluates to true. [incorrectStringBooleanError]
     test((utf8len(data, nfdi_test_data[i].str) == nlen));
     ^
   fs/unicode/utf8-selftest.c:191:3: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
     test((utf8nlen(data, nfdi_test_data[i].str, len) == nlen));
     ^
   fs/unicode/utf8-selftest.c:197:4: warning: Conversion of string literal 
"Unexpected byte 0x%x should be 0x%xn" to bool always evaluates to true. 
[incorrectStringBooleanError]
      test_f((c == nfdi_test_data[i].dec[j]),
      ^
   fs/unicode/utf8-selftest.c:203:3: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
     test((j == nlen));
     ^
   fs/unicode/utf8-selftest.c:226:3: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
     test((utf8len(data, nfdicf_test_data[i].str) == nlen));
     ^
   fs/unicode/utf8-selftest.c:227:3: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
     test((utf8nlen(data, nfdicf_test_data[i].str, len) == nlen));
     ^
   fs/unicode/utf8-selftest.c:233:4: warning: Conversion of string literal 
"Unexpected byte 0x%x should be 0x%xn" to bool always evaluates to true. 
[incorrectStringBooleanError]
      test_f((c == nfdicf_test_data[i].ncf[j]),
      ^
   fs/unicode/utf8-selftest.c:239:3: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
     test((j == nlen));
     ^
   fs/unicode/utf8-selftest.c:260:3: warning: Conversion of string literal "%s 
%s comparison mismatchn" to bool always evaluates to true. 
[incorrectStringBooleanError]
     test_f(!utf8_strncmp(table, &s1, &s2),
     ^
   fs/unicode/utf8-selftest.c:270:3: warning: Conversion of string literal "%s 
%s comparison mismatchn" to bool always evaluates to true. 
[incorrectStringBooleanError]
     test_f(!utf8_strncasecmp(table, &s1, &s2),
     ^
   fs/unicode/utf8-selftest.c:280:2: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
    test(utf8version_is_supported(7, 0, 0));
    ^
   fs/unicode/utf8-selftest.c:283:2: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
    test(utf8version_is_supported(9, 0, 0));
    ^
   fs/unicode/utf8-selftest.c:286:2: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
    test(utf8version_is_supported(latest_maj, latest_min, latest_rev));
    ^
   fs/unicode/utf8-selftest.c:289:2: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
    test(!utf8version_is_supported(12, 0, 0));
    ^
   fs/unicode/utf8-selftest.c:290:2: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
    test(!utf8version_is_supported(0, 0, 0));
    ^
   fs/unicode/utf8-selftest.c:291:2: warning: Conversion of string literal "" 
to bool always evaluates to true. [incorrectStringBooleanError]
    test(!utf8version_is_supported(-1, -1, -1));
    ^

# 
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git/commit/?id=56427c9cf549342906953cfd1d180d014b78c97b
git remote add f2fs-stable 
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git
git fetch --no-tags f2fs-stable linux-4.19.y
git checkout 56427c9cf549342906953cfd1d180d014b78c97b
vim +190 fs/unicode/utf8-selftest.c

56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  170  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  171  static void 
check_utf8_nfdi(void)
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  172  {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  173          int i;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  174          struct 
utf8cursor u8c;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  175          const struct 
utf8data *data;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  176  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  177          data = 
utf8nfdi(UNICODE_AGE(latest_maj, latest_min, latest_rev));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  178          if (!data) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  179                  
pr_err("%s: Unable to load utf8-%d.%d.%d. Skipping.\n",
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  180                         
__func__, latest_maj, latest_min, latest_rev);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  181                  return;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  182          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  183  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  184          for (i = 0; i < 
ARRAY_SIZE(nfdi_test_data); i++) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  185                  int len 
= strlen(nfdi_test_data[i].str);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  186                  int 
nlen = strlen(nfdi_test_data[i].dec);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  187                  int j = 
0;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  188                  
unsigned char c;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  189  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25 @190                  
test((utf8len(data, nfdi_test_data[i].str) == nlen));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  191                  
test((utf8nlen(data, nfdi_test_data[i].str, len) == nlen));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  192  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  193                  if 
(utf8cursor(&u8c, data, nfdi_test_data[i].str) < 0)
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  194                          
pr_err("can't create cursor\n");
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  195  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  196                  while 
((c = utf8byte(&u8c)) > 0) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25 @197                          
test_f((c == nfdi_test_data[i].dec[j]),
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  198                          
       "Unexpected byte 0x%x should be 0x%x\n",
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  199                          
       c, nfdi_test_data[i].dec[j]);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  200                          
j++;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  201                  }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  202  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  203                  test((j 
== nlen));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  204          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  205  }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  206  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  207  static void 
check_utf8_nfdicf(void)
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  208  {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  209          int i;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  210          struct 
utf8cursor u8c;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  211          const struct 
utf8data *data;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  212  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  213          data = 
utf8nfdicf(UNICODE_AGE(latest_maj, latest_min, latest_rev));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  214          if (!data) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  215                  
pr_err("%s: Unable to load utf8-%d.%d.%d. Skipping.\n",
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  216                         
__func__, latest_maj, latest_min, latest_rev);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  217                  return;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  218          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  219  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  220          for (i = 0; i < 
ARRAY_SIZE(nfdicf_test_data); i++) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  221                  int len 
= strlen(nfdicf_test_data[i].str);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  222                  int 
nlen = strlen(nfdicf_test_data[i].ncf);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  223                  int j = 
0;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  224                  
unsigned char c;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  225  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  226                  
test((utf8len(data, nfdicf_test_data[i].str) == nlen));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  227                  
test((utf8nlen(data, nfdicf_test_data[i].str, len) == nlen));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  228  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  229                  if 
(utf8cursor(&u8c, data, nfdicf_test_data[i].str) < 0)
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  230                          
pr_err("can't create cursor\n");
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  231  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  232                  while 
((c = utf8byte(&u8c)) > 0) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  233                          
test_f((c == nfdicf_test_data[i].ncf[j]),
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  234                          
       "Unexpected byte 0x%x should be 0x%x\n",
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  235                          
       c, nfdicf_test_data[i].ncf[j]);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  236                          
j++;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  237                  }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  238  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  239                  test((j 
== nlen));
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  240          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  241  }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  242  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  243  static void 
check_utf8_comparisons(void)
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  244  {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  245          int i;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  246          struct 
unicode_map *table = utf8_load("11.0.0");
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  247  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  248          if 
(IS_ERR(table)) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  249                  
pr_err("%s: Unable to load utf8 %d.%d.%d. Skipping.\n",
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  250                         
__func__, latest_maj, latest_min, latest_rev);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  251                  return;
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  252          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  253  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  254          for (i = 0; i < 
ARRAY_SIZE(nfdi_test_data); i++) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  255                  const 
struct qstr s1 = {.name = nfdi_test_data[i].str,
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  256                          
                .len = sizeof(nfdi_test_data[i].str)};
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  257                  const 
struct qstr s2 = {.name = nfdi_test_data[i].dec,
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  258                          
                .len = sizeof(nfdi_test_data[i].dec)};
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  259  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25 @260                  
test_f(!utf8_strncmp(table, &s1, &s2),
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  261                         
"%s %s comparison mismatch\n", s1.name, s2.name);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  262          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  263  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  264          for (i = 0; i < 
ARRAY_SIZE(nfdicf_test_data); i++) {
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  265                  const 
struct qstr s1 = {.name = nfdicf_test_data[i].str,
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  266                          
                .len = sizeof(nfdicf_test_data[i].str)};
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  267                  const 
struct qstr s2 = {.name = nfdicf_test_data[i].ncf,
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  268                          
                .len = sizeof(nfdicf_test_data[i].ncf)};
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  269  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  270                  
test_f(!utf8_strncasecmp(table, &s1, &s2),
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  271                         
"%s %s comparison mismatch\n", s1.name, s2.name);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  272          }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  273  
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  274          
utf8_unload(table);
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  275  }
56427c9cf54934 Gabriel Krisman Bertazi 2019-04-25  276  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to