From patchwork Mon Mar 7 15:35:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 615881 X-Patchwork-Delegate: alexne@voltaire.com 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 p27FY2MW025027 for ; Mon, 7 Mar 2011 15:35:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751246Ab1CGPfF (ORCPT ); Mon, 7 Mar 2011 10:35:05 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:52687 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751413Ab1CGPfE (ORCPT ); Mon, 7 Mar 2011 10:35:04 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from alexne@mellanox.com) with SMTP; 7 Mar 2011 17:44:07 +0200 Received: from MTRCASDAG01.mtl.com (172.25.0.174) by MTLCAS01.mtl.com (10.0.8.71) with Microsoft SMTP Server (TLS) id 14.1.270.1; Mon, 7 Mar 2011 17:35:01 +0200 Received: from localhost (172.25.6.157) by MTRCASDAG01.mtl.com (172.25.0.174) with Microsoft SMTP Server (TLS) id 14.1.270.1; Mon, 7 Mar 2011 17:35:01 +0200 Date: Mon, 7 Mar 2011 17:35:01 +0200 From: Alex Netes To: Subject: [PATCH v2] opensm: fixed memory leak in osm_console() Message-ID: <20110307153501.GQ5577@calypso.voltaire.com> References: <20110307100302.GJ5577@calypso.voltaire.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110307100302.GJ5577@calypso.voltaire.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [172.25.6.157] 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Mar 2011 15:35:06 +0000 (UTC) diff --git a/opensm/main.c b/opensm/main.c index 756fe6f..b3abdbb 100644 --- a/opensm/main.c +++ b/opensm/main.c @@ -811,7 +811,7 @@ int main(int argc, char *argv[]) break; case 'l': - temp = strtol(optarg, NULL, 0); + temp = strtoul(optarg, NULL, 0); if (temp > 7) { fprintf(stderr, "ERROR: LMC must be 7 or less.\n"); @@ -876,8 +876,8 @@ int main(int argc, char *argv[]) break; case 'p': - temp = strtol(optarg, NULL, 0); - if (0 > temp || 15 < temp) { + temp = strtoul(optarg, NULL, 0); + if (temp > 15) { fprintf(stderr, "ERROR: priority must be between 0 and 15\n"); return -1; @@ -986,8 +986,8 @@ int main(int argc, char *argv[]) opt.do_mesh_analysis = TRUE; break; case 6: - temp = strtol(optarg, NULL, 0); - if (temp < 0 || temp >= IB_MAX_NUM_VLS) { + temp = strtoul(optarg, NULL, 0); + if (temp >= IB_MAX_NUM_VLS) { fprintf(stderr, "ERROR: starting lash vl must be between 0 and 15\n"); return -1; @@ -996,8 +996,8 @@ int main(int argc, char *argv[]) printf(" LASH starting VL = %d\n", opt.lash_start_vl); break; case 7: - temp = strtol(optarg, NULL, 0); - if (temp < 0 || temp > 15) { + temp = strtoul(optarg, NULL, 0); + if (temp > 15) { fprintf(stderr, "ERROR: SM's SL must be between 0 and 15\n"); return -1;