From patchwork Sun Feb 18 20:39:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10226937 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 609A6602CB for ; Sun, 18 Feb 2018 20:40:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AA6A28898 for ; Sun, 18 Feb 2018 20:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 157B028874; Sun, 18 Feb 2018 20:40:20 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 841A128874 for ; Sun, 18 Feb 2018 20:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbeBRUkN (ORCPT ); Sun, 18 Feb 2018 15:40:13 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:38826 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751554AbeBRUkM (ORCPT ); Sun, 18 Feb 2018 15:40:12 -0500 Received: by mail-wr0-f195.google.com with SMTP id n7so7720557wrn.5 for ; Sun, 18 Feb 2018 12:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TLUt6i1tE3CB7kMTnY5BbNvNA/UY00SA09foj+EIf+g=; b=Bjjjkq1QtOhi0chMz8JLxuuUewRJZAm2GOcgYWLR0LkkgbmdrURHblCBDFd5UXgxTD UVjKJNLppCSQGR3J/5XOeFqm4WDgMNuwa5z9YjPi1LEpyIjXm1oEbpd64uoVF+nkhv8W lLxP9CvnvTx8H9OwNHKzFAMkHWep9SApkDLOWTnC0HO99Z1BR4dCaPlZdWy5YhBi12DR 11vw7meoTesiL1ILPGHufYEnwtoQ39a+fdb0ORbNtVgT63wysToF4BxApiFa25n81ix5 eGZ5voqTbNeQRB4NjrqRj4pQ36EbK76Eowjkp77s8V3b/57Pf5X/XgWJb0KMtN8baqP2 uUlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TLUt6i1tE3CB7kMTnY5BbNvNA/UY00SA09foj+EIf+g=; b=EyiKJ8JtyNXaFzk6AFe6ZToXuQW0hkwruokXJubXS3P5kkojZowGl7dKBz88732WNk X/xLPlj9esYwkmijjmzN06I9MmINcbrRrOc/Sta9Jeu1qnbiE5pwJzAPfT7Iai8tnNSO GSahmu8mq3IrqFPahoxehpSohOtV5hNZIJ7YRlhAnfqNNP/wCvg7lguGUWpH0Up+V+7a mmEEHESOaVALzd2O9W/KFpjooCmhTw8ipRzO+IYRp7ffkRcmhoZvW2MQhB/HzdJ9Apsl QtbrNPqSklDAswGBk0PbQKDb/n1q9zlHEB++OFS7HMqRU5MUjWsl5NfF9ZIafvnmJOJa 4tLQ== X-Gm-Message-State: APf1xPC4wWLl8gsZVPO/EnjMVkwXXoAVLhlONzIGmWImNcWtZA4OoQ+i 76mgWmxYHdx1vnp8gnYwvP2I5JNzJxo= X-Google-Smtp-Source: AH8x224G2l+CjK/ylrJ9jH4q54tF+EEm9TjbYC0EicZy6dSKSo21HToW+VhP06+z4k+77nmp2MUsHA== X-Received: by 10.223.202.9 with SMTP id o9mr11609301wrh.40.1518986411150; Sun, 18 Feb 2018 12:40:11 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id 67sm22478066wmg.13.2018.02.18.12.40.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 12:40:09 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1enVkj-0001wi-O5; Sun, 18 Feb 2018 13:40:05 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core 1/6] verbs: Fix size of verbs_ex_private allocation Date: Sun, 18 Feb 2018 13:39:57 -0700 Message-Id: <20180218204002.7408-2-jgg@ziepe.ca> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180218204002.7408-1-jgg@ziepe.ca> References: <20180218204002.7408-1-jgg@ziepe.ca> 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: Jason Gunthorpe Missing '*' causes the size to be wrong if the struct is expanded. It works as-is today because the struct contains exactly one pointer so sizeof(struct verbs_ex_prviate *) == sizeof(struct verbs_ex_private) Fixes: 1111cf9895bb ("verbs: Always allocate a verbs_context") Signed-off-by: Jason Gunthorpe --- libibverbs/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libibverbs/device.c b/libibverbs/device.c index 682a504f863802..8b97dde779e0ba 100644 --- a/libibverbs/device.c +++ b/libibverbs/device.c @@ -217,7 +217,7 @@ int verbs_init_context(struct verbs_context *context_ex, context_ex->ABI_placeholder2 = (void (*)(void))context_ex->ibv_destroy_flow; - context_ex->priv = calloc(1, sizeof(context_ex->priv)); + context_ex->priv = calloc(1, sizeof(*context_ex->priv)); if (!context_ex->priv) { errno = ENOMEM; close(cmd_fd);