From patchwork Tue Feb 14 21:23:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9572919 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 40296601E7 for ; Tue, 14 Feb 2017 21:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D3DF27CEA for ; Tue, 14 Feb 2017 21:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FFC62840B; Tue, 14 Feb 2017 21:24:23 +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=-6.9 required=2.0 tests=BAYES_00,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 A55A327CEA for ; Tue, 14 Feb 2017 21:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751481AbdBNVYV (ORCPT ); Tue, 14 Feb 2017 16:24:21 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:50377 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750810AbdBNVYU (ORCPT ); Tue, 14 Feb 2017 16:24:20 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MIxJ3-1cfgOD1c1x-002Yzm; Tue, 14 Feb 2017 22:24:04 +0100 From: Arnd Bergmann To: Mike Marciniszyn , Dennis Dalessandro Cc: Arnd Bergmann , Doug Ledford , Sean Hefty , Hal Rosenstock , Ira Weiny , Jubin John , Jianxin Xiong , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/hfi1: use size_t for passing array length Date: Tue, 14 Feb 2017 22:23:07 +0100 Message-Id: <20170214212358.2730288-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:edZvJHA9ZJtzLyJ3cy94JJ7Wc4w0KA5NFAc+21awroeGgMCKjJP vWvNWHpgR1qLjJAe4LRSAdNwoVOWCDhl5MiHp0OebnGsWKzoF4PjfZhGQ2OAMfCH/eRjE9y tCDqmQs8RIFjSzsLwY9tlkCoGLIxyPlxdBMk4FQS4Bqj5M//rnIN+ot5QL+EiuwInrw/Mxe Dj7o0rNv54OpLRZcpmSnw== X-UI-Out-Filterresults: notjunk:1; V01:K0:550fFSWMXMU=:Xm7ddIjqtDAEF6fQ1yG0ab JZMxDTz5hC0/fO4fMmsfyl7Yy+XuE6a6UH+rGDfNCxx75RP49XYLl0yM6tkZ0CbTGEvRw6HRO MD7qOlqduG2AA5O7kqpuVo1gNy9KM3KyHnqSHoar7B/NRXiyLdog/2kol4gO2fd38SG/mVorB /zzUtlZrgAcYvk9afXDb1mfGa3J1z55V5dD+MAQ9jzRjJwMSYU855bF+8DkuwFeN6GudjAlbq 5Ylz/d8kX5pBb3V09uxzWx3gPYJCuCeoVaLD6WtlyBE3vQfvpiDGLIPkslf1MoS+oB8NktVQh sfq2SiaErdVOUfVqED6iLLJf4Yy/gSW158Q0gCD7pxM4ONehyoPx/MweQlEF27L5IVzCewAf+ swOuZWJGEoSR1r21fxNDEmTvi+tWKr6+Bv4JcGOXf+7GKQtf5C+vjg7Prtpyvkd7Q9XWUNmb3 M4/lZB5t07yovy6hoQUmGLn88WU+vCGsoGQiIOa2q78uZpheXmqMwA2oqkrooOpBL2R8Lt0/6 tY4vq6wrSV/tq8ZrVTVfASesc2oaSm62DENVDuEEB/gxzJilyT5AWFhe4z4zjE5Z7yksf+L35 AzAgvkgsHKc8AFK8LXgFh1c4nmB2wd7xzHikH80cfYDgUk/TCTWfow2mUCpv/v6dbz1Xi92aF WPfQHsxXDjn4ymiR5g/Zn7co5OrpXryMHyuRr82TRg5flH9EVNOHMUiyusgxbt07Tyv8= 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 gcc-7 produces a mysterious warning about the size argument being potentially out of range: drivers/infiniband/hw/hfi1/verbs.c: In function 'init_cntr_names': drivers/infiniband/hw/hfi1/verbs.c:1644:2: error: 'memcpy': specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] This seems to refer to a the case where an 64-bit size_t gets truncated into a negative 'int' and subsequently turned into a high 64-bit number again. The fix is clearly to use size_t here, which matches the type that gets used for this value elsewhere. Fixes: b7481944b06e ("IB/hfi1: Show statistics counters under IB stats interface") Signed-off-by: Arnd Bergmann Reviewed-by: Leon Romanovsky --- drivers/infiniband/hw/hfi1/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c index 95ed4d6da510..1d8ac9432742 100644 --- a/drivers/infiniband/hw/hfi1/verbs.c +++ b/drivers/infiniband/hw/hfi1/verbs.c @@ -1618,7 +1618,7 @@ static int cntr_names_initialized; * external strings. */ static int init_cntr_names(const char *names_in, - const int names_len, + const size_t names_len, int num_extra_names, int *num_cntrs, const char ***cntr_names)