From patchwork Wed Jan 2 13:13:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10746343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19401746 for ; Wed, 2 Jan 2019 13:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F368F28813 for ; Wed, 2 Jan 2019 13:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7F512884B; Wed, 2 Jan 2019 13:14:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3C2628813 for ; Wed, 2 Jan 2019 13:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729905AbfABNOV (ORCPT ); Wed, 2 Jan 2019 08:14:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55586 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729450AbfABNOV (ORCPT ); Wed, 2 Jan 2019 08:14:21 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A7CBC04AC54; Wed, 2 Jan 2019 13:14:21 +0000 (UTC) Received: from localhost (ovpn-12-97.pek2.redhat.com [10.72.12.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D2B319936; Wed, 2 Jan 2019 13:14:20 +0000 (UTC) From: Honggang Li To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [ibsim patch 11/23] sim_cmd.c: fix CONSTANT_EXPRESSION_RESULT for dump_route Date: Wed, 2 Jan 2019 21:13:06 +0800 Message-Id: <20190102131318.5765-11-honli@redhat.com> In-Reply-To: <20190102131318.5765-1-honli@redhat.com> References: <20190102131318.5765-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 02 Jan 2019 13:14:21 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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) {