[PATCH 12/20] imfs/imfs_handlers_link.c: Add _Assert for NULL pointer

Joel Sherrill joel.sherrill at oarcorp.com
Tue Nov 25 23:02:40 UTC 2014


From: Josh Oguin <josh.oguin at oarcorp.com>

CodeSonar flagged this as a possible dereference of a NULL pointer.
This should never occur so adding _Assert().
---
 cpukit/libfs/src/imfs/imfs_handlers_link.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpukit/libfs/src/imfs/imfs_handlers_link.c b/cpukit/libfs/src/imfs/imfs_handlers_link.c
index 7c2a341..cd71f95 100644
--- a/cpukit/libfs/src/imfs/imfs_handlers_link.c
+++ b/cpukit/libfs/src/imfs/imfs_handlers_link.c
@@ -78,6 +78,8 @@ static IMFS_jnode_t *IMFS_node_remove_hard_link(
 {
   IMFS_jnode_t *target = node->info.hard_link.link_node;
 
+  _Assert( target != NULL );
+
   if ( target->st_nlink == 1) {
     target = (*target->control->node_remove)( target );
     if ( target == NULL ) {
-- 
1.9.3




More information about the devel mailing list