[RTEMS Project] #2879: src/cpukit/libdebugger/rtems-debugger-server.c: four problems

RTEMS trac trac at rtems.org
Mon Jan 23 17:41:54 UTC 2017


#2879: src/cpukit/libdebugger/rtems-debugger-server.c: four problems
---------------------+------------------
 Reporter:  dcb      |      Owner:
     Type:  defect   |     Status:  new
 Priority:  normal   |  Milestone:  4.12
Component:  General  |    Version:  4.11
 Severity:  normal   |   Keywords:
---------------------+------------------
 1.

 src/cpukit/libdebugger/rtems-debugger-server.c:1306]: (style) Redundant
 condition: extended. '!extended || (extended && check_pid(pid))' is
 equivalent to '!extended || check_pid(pid)'

 Suggest simplify.

 2.

 src/cpukit/libdebugger/rtems-debugger-server.c:1858]: (warning) Possible
 null pointer dereference: rtems_debugger

 Source code is

   if (r < 0) {
     rtems_printf(printer, "error: rtems-db: remote begin: %s: %s\n",
                  rtems_debugger->remote->name, strerror(errno));
     free(rtems_debugger);
     rtems_debugger = NULL;
   }

   /*
    * Reset at the end of the session.
    */
   rtems_debugger->flags = 0;

 Suggest adding return -1 inside the if.

 3.

 src/cpukit/libdebugger/rtems-debugger-server.c:906]: (style) Redundant
 condition: extended. '!extended || (extended && check_pid(pid))' is
 equivalent to '!extended || check_pid(pid)'

 Duplicate.

 4.

 src/cpukit/libdebugger/rtems-debugger-server.c:956]: (warning) Char
 literal compared with pointer 'p'. Did you intend to dereference it?

 Source code is

   while (p != NULL && p != '\0') {

 Maybe better code

   while (p != NULL && *p != '\0') {

--
Ticket URL: <http://devel.rtems.org/ticket/2879>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list