On Fri, Jan 04, 2019 at 07:24:34AM -0500, Hal Rosenstock wrote: > On 1/2/2019 8:13 AM, Honggang Li wrote: > > Issue was detected by Coverity. > > > > "(outport = node->sw->fdb[lid]) < 0" is always false regardless of > > the values of its operands, because node->sw->fdb[lid] is uint8_t. > > > > Signed-off-by: Honggang Li <honli@xxxxxxxxxx> > > --- > > ibsim/sim_mad.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c > > index b6e24881fb9e..5ef1d0a6dbeb 100644 > > --- a/ibsim/sim_mad.c > > +++ b/ibsim/sim_mad.c > > @@ -1579,12 +1579,11 @@ static int switch_lookup(Node * node, int lid) > > if (!node->sw) > > return -1; > > > > - if (lid > node->sw->linearFDBtop || (outport = node->sw->fdb[lid]) < 0) { > > + if (lid > node->sw->linearFDBtop) { > > Same comment as patch 11/23. > > This is not the proper fix. I think that the check should be == 0xff Yes, you are right. Please fix it as 11/23. > rather than < 0 or eliminated as in this patch since fdb is initialized > to 0xff (no port for LID). > > -- Hal > > > IBWARN("sw guid %" PRIx64 ": bad lid %u", node->nodeguid, lid); > > return -1; > > } > > - > > - return outport; > > + return outport = node->sw->fdb[lid]; > > } > > > > static int port_get_remote(Port * port, Node ** remotenode, Port ** remoteport) > >