Hello Jason Wessel,

The patch 5d5314d6795f: "kdb: core for kgdb back end (1 of 2)" from
May 20, 2010, leads to the following static checker warning:

        kernel/debug/kdb/kdb_io.c:352 kdb_read()
        warn: bool is not less than zero.

kernel/debug/kdb/kdb_io.c
   337                  len = strlen(p_tmp);
   338                  count = kallsyms_symbol_complete(p_tmp,
   339                                                   sizeof(tmpbuffer) -
   340                                                   (p_tmp - tmpbuffer));
   341                  if (tab == 2 && count > 0) {
   342                          kdb_printf("\n%d symbols are found.", count);
   343                          if (count > dtab_count) {
   344                                  count = dtab_count;
   345                                  kdb_printf(" But only first %d symbols 
will"
   346                                             " be printed.\nYou can 
change the"
   347                                             " environment variable 
DTABCOUNT.",
   348                                             count);
   349                          }
   350                          kdb_printf("\n");
   351                          for (i = 0; i < count; i++) {
   352                                  if (kallsyms_symbol_next(p_tmp, i) < 0)

The kallsyms_symbol_next() function returns 1 on found and 0 on not
found so this test should be "== 0" instead of "< 0".

   353                                          break;
   354                                  kdb_printf("%s ", p_tmp);

Presumably we print the same thing over and over "count" times.

   355                                  *(p_tmp + len) = '\0';
                                                  ^^^
"len" was calculated back on line 337.  We don't need to update it?  I'm
not sure I understand this line.

   356                          }

regards,
dan carpenter

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to