From patchwork Mon Oct 4 10:16:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 228171 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o94AH4cB001015 for ; Mon, 4 Oct 2010 10:17:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333Ab0JDKRD (ORCPT ); Mon, 4 Oct 2010 06:17:03 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:60805 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754050Ab0JDKRC (ORCPT ); Mon, 4 Oct 2010 06:17:02 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from kliteyn@mellanox.co.il) with SMTP; 4 Oct 2010 12:16:01 +0200 Received: from [10.4.1.29] (10.4.1.29) by mtlmail01.mtl.com (10.0.8.12) with Microsoft SMTP Server id 8.2.254.0; Mon, 4 Oct 2010 12:16:58 +0200 Message-ID: <4CA9A98B.80605@mellanox.co.il> Date: Mon, 4 Oct 2010 12:16:43 +0200 From: Yevgeny Kliteynik Reply-To: kliteyn@dev.mellanox.co.il User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky , Linux RDMA Subject: [PATCH] ibstat.c: fix core dump if wrong port phys state is reported Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 04 Oct 2010 10:17:05 +0000 (UTC) diff --git a/infiniband-diags/src/ibstat.c b/infiniband-diags/src/ibstat.c index f655a13..f51d17b 100644 --- a/infiniband-diags/src/ibstat.c +++ b/infiniband-diags/src/ibstat.c @@ -114,7 +114,7 @@ static int port_dump(umad_port_t * port, int alone) (unsigned)port->state <= 4 ? port_state_str[port->state] : "???"); printf("%sPhysical state: %s\n", pre, - (unsigned)port->state <= + (unsigned)port->phys_state <= 7 ? port_phy_state_str[port->phys_state] : "???"); printf("%sRate: %d\n", pre, port->rate); printf("%sBase lid: %d\n", pre, port->base_lid);