From patchwork Tue Apr 18 09:03:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 9685219 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 00A5B602C9 for ; Tue, 18 Apr 2017 09:05:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1078283F2 for ; Tue, 18 Apr 2017 09:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5D8E283F9; Tue, 18 Apr 2017 09:05:53 +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 81C61283F2 for ; Tue, 18 Apr 2017 09:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756320AbdDRJFF (ORCPT ); Tue, 18 Apr 2017 05:05:05 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:37739 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756088AbdDRJEB (ORCPT ); Tue, 18 Apr 2017 05:04:01 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 18 Apr 2017 12:03:53 +0300 Received: from gen-l-vrt-078.mtl.labs.mlnx. (gen-l-vrt-078.mtl.labs.mlnx [10.137.78.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v3I93qSO011257; Tue, 18 Apr 2017 12:03:52 +0300 From: Matan Barak To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Sean Hefty , Liran Liss , Majd Dibbiny , Yishai Hadas , Ira Weiny , Christoph Lameter , Matan Barak Subject: [PATCH for-next 5/6] IB/core: Don't use is_async in event files to infer events size Date: Tue, 18 Apr 2017 12:03:41 +0300 Message-Id: <1492506222-28999-6-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1492506222-28999-1-git-send-email-matanb@mellanox.com> References: <1492506222-28999-1-git-send-email-matanb@mellanox.com> 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 Previously, we inferred the events size in ib_uverbs_event_read by using the is_async flag. Instead of that, we pass the event size directly. Fixes: 1e7710f3f656 ('IB/core: Change completion channel to use the reworked objects schema') Signed-off-by: Matan Barak Reviewed-by: Sean Hefty --- drivers/infiniband/core/uverbs_main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 0b0dab8..4ab0e5d 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c @@ -257,10 +257,9 @@ static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_file *file, struct ib_uverbs_file *uverbs_file, struct file *filp, char __user *buf, size_t count, loff_t *pos, - bool is_async) + size_t eventsz) { struct ib_uverbs_event *event; - int eventsz; int ret = 0; spin_lock_irq(&file->lock); @@ -290,11 +289,6 @@ static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_file *file, event = list_entry(file->event_list.next, struct ib_uverbs_event, list); - if (is_async) - eventsz = sizeof (struct ib_uverbs_async_event_desc); - else - eventsz = sizeof (struct ib_uverbs_comp_event_desc); - if (eventsz > count) { ret = -EINVAL; event = NULL; @@ -326,7 +320,8 @@ static ssize_t ib_uverbs_async_event_read(struct file *filp, char __user *buf, struct ib_uverbs_async_event_file *file = filp->private_data; return ib_uverbs_event_read(&file->ev_file, file->uverbs_file, filp, - buf, count, pos, true); + buf, count, pos, + sizeof(struct ib_uverbs_async_event_desc)); } static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf, @@ -337,7 +332,8 @@ static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf, return ib_uverbs_event_read(&comp_ev_file->ev_file, comp_ev_file->uobj_file.ufile, filp, - buf, count, pos, false); + buf, count, pos, + sizeof(struct ib_uverbs_comp_event_desc)); } static unsigned int ib_uverbs_event_poll(struct ib_uverbs_event_file *file,