From patchwork Mon Mar 27 12:43:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9646597 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 25DFE602D6 for ; Mon, 27 Mar 2017 12:45:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18E9B28249 for ; Mon, 27 Mar 2017 12:45:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AA76282ED; Mon, 27 Mar 2017 12:45: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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 7BBB528249 for ; Mon, 27 Mar 2017 12:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752536AbdC0Mor (ORCPT ); Mon, 27 Mar 2017 08:44:47 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:36367 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752259AbdC0Mor (ORCPT ); Mon, 27 Mar 2017 08:44:47 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Mar 2017 14:44:00 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v2RCi0QO010970; Mon, 27 Mar 2017 15:44:00 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id v2RCi0I5017061; Mon, 27 Mar 2017 15:44:00 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v2RChxjT017059; Mon, 27 Mar 2017 15:43:59 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, majd@mellanox.com, jgunthorpe@obsidianresearch.com, dledford@redhat.com, Artemy Kovalyov Subject: [PATCH rdma-core] mlx5: Fix device context allocation Date: Mon, 27 Mar 2017 15:43:29 +0300 Message-Id: <1490618609-16931-1-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 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: Artemy Kovalyov Use calloc to allocate device context so the unset bytes are zero. When building a *non* release mode (i.e. without DCMAKE_BUILD_TYPE=Release) the below assert is applicable and might raise: assert(dev->_ops._dummy1). Fix below commit to use calloc instead of malloc for mlx5 as well. Fixes: 85c449528709 ("providers: Make every provider allocate a verbs_device") Signed-off-by: Artemy Kovalyov Reviewed-by: Yishai Hadas --- Pull request was sent: https://github.com/linux-rdma/rdma-core/pull/109 providers/mlx5/mlx5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c index edb6d35..30f165b 100644 --- a/providers/mlx5/mlx5.c +++ b/providers/mlx5/mlx5.c @@ -1006,7 +1006,7 @@ found: return NULL; } - dev = malloc(sizeof *dev); + dev = calloc(1, sizeof *dev); if (!dev) { fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n", uverbs_sys_path);