From patchwork Thu Sep 6 04:36:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10589863 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 2C38A920 for ; Thu, 6 Sep 2018 04:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C1A429982 for ; Thu, 6 Sep 2018 04:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1FAB2A639; Thu, 6 Sep 2018 04:36:54 +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 87DF529982 for ; Thu, 6 Sep 2018 04:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725880AbeIFJKY (ORCPT ); Thu, 6 Sep 2018 05:10:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47722 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725851AbeIFJKY (ORCPT ); Thu, 6 Sep 2018 05:10:24 -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 E734B87A84; Thu, 6 Sep 2018 04:36:52 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 535F82023416; Thu, 6 Sep 2018 04:36:50 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH] Fix pointer dereference in verify_val Date: Thu, 6 Sep 2018 12:36:45 +0800 Message-Id: <20180906043645.16931-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.1]); Thu, 06 Sep 2018 04:36:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 06 Sep 2018 04:36:52 +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 If endptr is not NULL, strtoul() stores the address of the first invalid character in *endptr. Fixes: 04d2a8be0305 ("osm_prtn_config.c: parse_group_flag log suspicious group flag value") Signed-off-by: Honggang Li --- opensm/osm_prtn_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensm/osm_prtn_config.c b/opensm/osm_prtn_config.c index bbd5bcf6..a7293bcb 100644 --- a/opensm/osm_prtn_config.c +++ b/opensm/osm_prtn_config.c @@ -271,7 +271,7 @@ static unsigned long int verify_val(unsigned lineno, osm_log_t *p_log, { char *end; unsigned long int ret = strtoul(val, &end, 0); - if (val && end) + if (val && *end) OSM_LOG(p_log, OSM_LOG_VERBOSE, "PARSE WARN: line %d: " "suspicious val=(%s) detected. "