[Bug 2144] New: is a nill pointer dereferenced in console_open if pDeviceFlow is nill?

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Wed Sep 11 22:18:47 UTC 2013


https://www.rtems.org/bugzilla/show_bug.cgi?id=2144

             Bug #: 2144
           Summary: is a nill pointer dereferenced in console_open if
                    pDeviceFlow is nill?
    Classification: Unclassified
           Product: RTEMS
           Version: 4.10
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: bsps
        AssignedTo: joel.sherrill at oarcorp.com
        ReportedBy: johill at lanl.gov


It seems that many BSPs initialize pDeviceFlow to nill so perhaps the following
is a good idea in console_open. Maybe pDeviceFlow is initialized in generic
code, but this isnt obvious after a quick search.

Thanks,

Jeff Hill

libbsp/shared/console.c


@@ -70,8 +70,14 @@ rtems_device_driver console_open(
   Callbacks.pollRead             = cptr->pDeviceFns->deviceRead;
   Callbacks.write                = cptr->pDeviceFns->deviceWrite;
   Callbacks.setAttributes        = cptr->pDeviceFns->deviceSetAttributes;
-  Callbacks.stopRemoteTx         = cptr->pDeviceFlow->deviceStopRemoteTx;
-  Callbacks.startRemoteTx        = cptr->pDeviceFlow->deviceStartRemoteTx;
+  if ( cptr->pDeviceFlow ) {
+    Callbacks.stopRemoteTx         = cptr->pDeviceFlow->deviceStopRemoteTx;
+    Callbacks.startRemoteTx        = cptr->pDeviceFlow->deviceStartRemoteTx;
+  }
+  else {
+    Callbacks.stopRemoteTx         = 0;
+    Callbacks.startRemoteTx        = 0;
+  }
   Callbacks.outputUsesInterrupts =
cptr->pDeviceFns->deviceOutputUsesInterrupts;

   /* XXX what about

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list