From patchwork Fri Jul 20 02:50:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10535901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 301AA6029B for ; Fri, 20 Jul 2018 02:51:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FF63298A6 for ; Fri, 20 Jul 2018 02:51:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1475E299DA; Fri, 20 Jul 2018 02:51:28 +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 B8904298A6 for ; Fri, 20 Jul 2018 02:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731087AbeGTDh1 (ORCPT ); Thu, 19 Jul 2018 23:37:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54572 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730514AbeGTDh1 (ORCPT ); Thu, 19 Jul 2018 23:37:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3BC34402B03F; Fri, 20 Jul 2018 02:51:26 +0000 (UTC) Received: from dhcp-129-124.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97A2C111E406; Fri, 20 Jul 2018 02:51:24 +0000 (UTC) From: Honggang LI To: hal@mellanox.com Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 5/6] Extend buf size to avoid format truncation Date: Fri, 20 Jul 2018 10:50:37 +0800 Message-Id: <20180720025038.9365-6-honli@redhat.com> In-Reply-To: <20180720025038.9365-5-honli@redhat.com> References: <20180720025038.9365-1-honli@redhat.com> <20180720025038.9365-2-honli@redhat.com> <20180720025038.9365-3-honli@redhat.com> <20180720025038.9365-4-honli@redhat.com> <20180720025038.9365-5-honli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 20 Jul 2018 02:51:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 20 Jul 2018 02:51:26 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 make[2]: Entering directory '/home/honli/upstream-repos/opensm/opensm' depbase=`echo osm_sm_mad_ctrl.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 -g -O2 -MT osm_sm_mad_ctrl.o -MD -MP -MF $depbase.Tpo -c -o osm_sm_mad_ctrl.o osm_sm_mad_ctrl.c &&\ mv -f $depbase.Tpo $depbase.Po osm_sm_mad_ctrl.c: In function ‘log_rcv_cb_error’: osm_sm_mad_ctrl.c:571:28: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4078 [-Werror=format-truncation=] "\n\t\t\tInitial path: %s Return path: %s", ^~ ipath, rpath); ~~~~~ osm_sm_mad_ctrl.c:570:3: note: ‘snprintf’ output between 33 and 8223 bytes into a destination of size 4096 snprintf(buf, sizeof(buf), ^~~~~~~~~~~~~~~~~~~~~~~~~~ "\n\t\t\tInitial path: %s Return path: %s", ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ipath, rpath); ~~~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Honggang Li --- opensm/osm_sm_mad_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensm/osm_sm_mad_ctrl.c b/opensm/osm_sm_mad_ctrl.c index ebac55877f76..1f548a9faa77 100644 --- a/opensm/osm_sm_mad_ctrl.c +++ b/opensm/osm_sm_mad_ctrl.c @@ -556,7 +556,7 @@ static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl, static void log_rcv_cb_error(osm_log_t *p_log, ib_smp_t *p_smp, ib_net16_t status) { - char buf[BUF_SIZE]; + char buf[BUF_SIZE*3]; uint32_t i; if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {