summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-20 17:25:15 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-21 13:13:22 -0600
commited4c5568c7b7dda50f7374b7e3d79e21c0ad8185 (patch)
tree7f29c43a2bf40fa370ddb87a6496292a3cf99dd9
parentpipe/fifo.c: NULL dereference flagged by Coverity ID 1063889 (diff)
downloadrtems-ed4c5568c7b7dda50f7374b7e3d79e21c0ad8185.tar.bz2
objectsetname.c: Fix always true condition (Coverity ID 1063874)
Coverity spotted the comparison (0 <= length) which is always true. Changed logic to address this.
-rw-r--r--cpukit/score/src/objectsetname.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c
index e405c8ac0c..c699570209 100644
--- a/cpukit/score/src/objectsetname.c
+++ b/cpukit/score/src/objectsetname.c
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2009.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -53,10 +53,10 @@ bool _Objects_Set_name(
#endif
{
the_object->name.name_u32 = _Objects_Build_name(
- ((0 <= length) ? s[ 0 ] : ' '),
- ((1 < length) ? s[ 1 ] : ' '),
- ((2 < length) ? s[ 2 ] : ' '),
- ((3 < length) ? s[ 3 ] : ' ')
+ ((length) ? s[ 0 ] : ' '),
+ ((length > 1) ? s[ 1 ] : ' '),
+ ((length > 2) ? s[ 2 ] : ' '),
+ ((length > 3) ? s[ 3 ] : ' ')
);
}