From patchwork Thu Aug 30 02:45:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10581165 X-Patchwork-Delegate: hal@mellanox.com 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 3F56E5A4 for ; Thu, 30 Aug 2018 02:46:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2586A2BD49 for ; Thu, 30 Aug 2018 02:46:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19AC42BD5A; Thu, 30 Aug 2018 02:46:03 +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 C92DF2BD49 for ; Thu, 30 Aug 2018 02:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727042AbeH3Gpy (ORCPT ); Thu, 30 Aug 2018 02:45:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726457AbeH3Gpx (ORCPT ); Thu, 30 Aug 2018 02:45:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D02940216E7; Thu, 30 Aug 2018 02:46:01 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71D082027056; Thu, 30 Aug 2018 02:45:58 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 1/2] osm_prtn_config.c: Sanity check the value of mgroup_flag flag Date: Thu, 30 Aug 2018 10:45:35 +0800 Message-Id: <20180830024536.4255-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 30 Aug 2018 02:46:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 30 Aug 2018 02:46:01 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'honli@redhat.com' RCPT:'' 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 From: Honggang Li As all flags are unsigned integer in different size, sanity check the value before covert the value to unsigned integer with 'strtoul'. Signed-off-by: Honggang Li --- opensm/osm_prtn_config.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/opensm/osm_prtn_config.c b/opensm/osm_prtn_config.c index f76ad4d4..be81e794 100644 --- a/opensm/osm_prtn_config.c +++ b/opensm/osm_prtn_config.c @@ -273,6 +273,20 @@ static int parse_group_flag(unsigned lineno, osm_log_t * p_log, { int rc = 0; int len = strlen(flag); + + char *tmp = val; + while (NULL != tmp && '\0' != *tmp) { + if (!isxdigit(*tmp)) { + OSM_LOG(p_log, OSM_LOG_VERBOSE, + "PARSE WARN: line %d: " + "suspicious val=(%s) detected. " + "flag=(%s)\n", lineno, val, flag); + return rc; + } + tmp++; + } + tmp = NULL; + if (!strncmp(flag, "mtu", len)) { rc = 1; if (!val || (flags->mtu = strtoul(val, NULL, 0)) == 0) From patchwork Thu Aug 30 02:45:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10581167 X-Patchwork-Delegate: hal@mellanox.com 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 EE43F5A4 for ; Thu, 30 Aug 2018 02:46:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB3C2BD32 for ; Thu, 30 Aug 2018 02:46:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D29CD2BD52; Thu, 30 Aug 2018 02:46:04 +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 8804D2BD49 for ; Thu, 30 Aug 2018 02:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727089AbeH3Gp4 (ORCPT ); Thu, 30 Aug 2018 02:45:56 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726457AbeH3Gp4 (ORCPT ); Thu, 30 Aug 2018 02:45:56 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C822406E81C; Thu, 30 Aug 2018 02:46:03 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1BA72027056; Thu, 30 Aug 2018 02:46:01 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 2/2] partition-config.txt: emphasize that the field of mgroup_flag must be spilt with "comma" Date: Thu, 30 Aug 2018 10:45:36 +0800 Message-Id: <20180830024536.4255-2-honli@redhat.com> In-Reply-To: <20180830024536.4255-1-honli@redhat.com> References: <20180830024536.4255-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 30 Aug 2018 02:46:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 30 Aug 2018 02:46:03 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'honli@redhat.com' RCPT:'' 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 From: Honggang Li Signed-off-by: Honggang Li --- doc/partition-config.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/partition-config.txt b/doc/partition-config.txt index 3bdb9577..84ae798b 100644 --- a/doc/partition-config.txt +++ b/doc/partition-config.txt @@ -114,6 +114,7 @@ General file format: (default is 0) FlowLabel= - specifies FlowLabel for this MC group (default is 0) + NOTE: All mgroup_flag flags MUST be spilt with comma (,). Note that values for rate, mtu, and scope, for both partitions and multicast groups, should be specified as defined in the IBTA specification (for example,