From patchwork Fri Jun 28 08:07:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 2797481 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C0ABEBF4A1 for ; Fri, 28 Jun 2013 08:07:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A767120129 for ; Fri, 28 Jun 2013 08:07:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D2C9200E7 for ; Fri, 28 Jun 2013 08:07:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754728Ab3F1IHM (ORCPT ); Fri, 28 Jun 2013 04:07:12 -0400 Received: from na3sys010aog101.obsmtp.com ([74.125.245.70]:43608 "HELO na3sys010aog101.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754678Ab3F1IHH (ORCPT ); Fri, 28 Jun 2013 04:07:07 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]) (using TLSv1) by na3sys010aob101.postini.com ([74.125.244.12]) with SMTP ID DSNKUc1EKtZQVyrcpckWcH7w6N6xOoSuYwJ0@postini.com; Fri, 28 Jun 2013 01:07:07 PDT Received: by mail-pa0-f41.google.com with SMTP id bj3so2152996pad.0 for ; Fri, 28 Jun 2013 01:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=RekYrja1mWatj9A6+zLpMJy6dfDEbaYxvaX4TBtNmfg=; b=dMAGxebqVarhnAdyczBjTxBsDCgnM5mHF7aAgrukyvQNRwLzL+DcvIotAyiupxRoXh RX3nmWx6wY4fskxoRNzLAzdodDuVqtnURKtmIUPphQwwbtA0c1G0E8g+I2w3mW89+N8T kX1rBGMVwrsd2mH5dWMEexVwFRQYW4hWeAVXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=RekYrja1mWatj9A6+zLpMJy6dfDEbaYxvaX4TBtNmfg=; b=k7023kDRDL9kL25vzfudm4+aCjd5PXj7f2YHZIw2XJaAKozHi3mTgUe79S6ctnY79Q pFKlpTSCEgY+8J8XL8EQvphqvjj2CjQhxnk6WkQMXilWYraruV9cnbH4sU7x/q7qvaZj 1AAe/KNdN8voD7CbphHiY2Z9C971DTSek20jq+j+FhVKUm3VbMVgdXOJQeNJZb0iJyeD qzza5ypbSxqFGCFkbUoU2yqPjE7DdB5Yy9k2wKFFAAYe/eDP8QWqWpixU+7lT1v/jxJV /qo/yEhW7eT6YX7AqrhskexjQ0+qhZIsjfRENUMgOw7Auc37OVSmNF6FD2+8TCx/suA/ jLYQ== X-Received: by 10.68.136.138 with SMTP id qa10mr10252459pbb.117.1372406825594; Fri, 28 Jun 2013 01:07:05 -0700 (PDT) X-Received: by 10.68.136.138 with SMTP id qa10mr10252449pbb.117.1372406825467; Fri, 28 Jun 2013 01:07:05 -0700 (PDT) Received: from roland-t410s.home.digitalvampire.org (c-24-4-101-51.hsd1.ca.comcast.net. [24.4.101.51]) by mx.google.com with ESMTPSA id ri8sm7032049pbc.3.2013.06.28.01.07.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Jun 2013 01:07:04 -0700 (PDT) From: Roland Dreier To: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Subject: [PATCH] osmtest: Make the "-guid" option's argument mandatory Date: Fri, 28 Jun 2013 01:07:00 -0700 Message-Id: <1372406820-11505-1-git-send-email-roland@kernel.org> X-Mailer: git-send-email 1.8.1.2 X-Gm-Message-State: ALoCoQlesruD1gzfFfXhnCUMWid17coaAOEo9oKnn2/JRZ1IEZJfaAZrpo05CRjBvtPYCVI5w1HgcAv7uoV8bjtkpQe6mrn59FWj00/qOy0H6ByJqrLoECOZF2bA3dunhXVca7udJq1F21LmmrBZdMLPV2B8tubiBZLBBvLjm3RNghOVYWl+Q20= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Roland Dreier Currently, the getopt table in osmtest labels the "-guid" option as taking an optional argument; however, running osmtest with the -guid option but no argument just leads to: $ /usr/sbin/osmtest -guid Command Line Arguments Segmentation fault because the handling for the -guid option just passes optarg directly to strtoull(), and without and argument, optarg is NULL. Really, the argument should be mandatory. This bug was found by the Mayhem tool: http://www.forallsecure.com/bug-reports/edea01ceefbb188dcc62b3fc4f59dc743d7429c9/ Signed-off-by: Roland Dreier --- osmtest/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osmtest/main.c b/osmtest/main.c index 6129674..f48910b 100644 --- a/osmtest/main.c +++ b/osmtest/main.c @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) {"wait", 1, NULL, 'w'}, {"inventory", 1, NULL, 'i'}, {"max_lid", 1, NULL, 'm'}, - {"guid", 2, NULL, 'g'}, + {"guid", 1, NULL, 'g'}, {"port", 0, NULL, 'p'}, {"help", 0, NULL, 'h'}, {"stress", 1, NULL, 's'},