[ibsim patch 11/23] sim_cmd.c: fix CONSTANT_EXPRESSION_RESULT for dump_route

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



node->sw->fdb[to] is uint8_t. So, (node->sw->fdb[to] < 0) is always
false.

Issue was detected by Coverity.

Signed-off-by: Honggang Li <honli@xxxxxxxxxx>
---
 ibsim/sim_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ibsim/sim_cmd.c b/ibsim/sim_cmd.c
index e2fe6ba6dddb..1d36c600814f 100644
--- a/ibsim/sim_cmd.c
+++ b/ibsim/sim_cmd.c
@@ -751,8 +751,8 @@ static int dump_route(FILE * f, char *line)
 			break;	// found
 		outport = portnum;
 		if (node->type == SWITCH_NODE) {
-			if ((outport = node->sw->fdb[to]) < 0
-			    || to > node->sw->linearFDBtop)
+			outport = node->sw->fdb[to];
+			if (to > node->sw->linearFDBtop)
 				goto badtbl;
 			port = ports + node->portsbase + outport;
 			if (outport == 0) {
-- 
2.15.0-rc1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux