From patchwork Fri Feb 10 21:05:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9567517 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 BCCCA602B6 for ; Fri, 10 Feb 2017 21:06:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACC2D285C5 for ; Fri, 10 Feb 2017 21:06:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A042F285D9; Fri, 10 Feb 2017 21:06:43 +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 5398D285C5 for ; Fri, 10 Feb 2017 21:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbdBJVGl (ORCPT ); Fri, 10 Feb 2017 16:06:41 -0500 Received: from mout.web.de ([212.227.17.11]:64303 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbdBJVGj (ORCPT ); Fri, 10 Feb 2017 16:06:39 -0500 Received: from [192.168.1.2] ([77.182.113.129]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LpNwf-1by21d3AV3-00fDda; Fri, 10 Feb 2017 22:05:45 +0100 Subject: [PATCH 5/5] IB/hfi1: Improve another size determination in hfi1_user_sdma_process_request() To: linux-rdma@vger.kernel.org, Dennis Dalessandro , Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty References: <8a997282-09c7-0f9f-645e-d7c6e8c79e67@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Fri, 10 Feb 2017 22:05:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <8a997282-09c7-0f9f-645e-d7c6e8c79e67@users.sourceforge.net> X-Provags-ID: V03:K0:N772AawPMJL1mB7T+sLRgwEtWaboOahVoHzgUKk++UtyTTr94/X CfU1alYNucvnZ40A3bikOgXYaA82sA6TsDbBhizj29xBHZlO4J+9OmHd/h400PO2EYUFrY8 BpCIrvedMkgY6kZ1Ho8i86awh8qhtiMFNf8JldYDZblRQvDfDQpyr7bYS5hGDnhntgAC8EC InpaEui3btQ64G1DEhxig== X-UI-Out-Filterresults: notjunk:1; V01:K0:j/P8c8And64=:+diQIXEcrWYCH3m21XZTk1 fCZKeAdotcF3eSmX81OcVrtDJq5IOI8f7uRAa4iWAjjjujXjz3Hs28ea0Fad8KrNA1M/yKVJx 0DWVXjv8BvDBKTwP6XKzsZqmychRFrnRxKAEguuO8iV+McNs2KFp3cjCBP1eEDbd9FxlY1qT6 VD0nDxP6BNHDR+4W6uUJsm0n2hFE5aWWegzwDuPXhYKpsl8wwfUZUvhla2GBLdWYhx4ocv16S RLo8btQEYYZE/n+Zhz2cYXFn0AC7muKx2MNZmft/D9YOxhr/HTt2T0ryXmanCoXYHaD//KkHO JvaDBwu/rtzktkprD1i/m+Ww+96dKFogUQX9GrOq+WzP+5v0g3jCCa9KUlQ69PTXfkwPYzspt 1OznOvNFRVmKrVykZ8fixa46OjllxUVVWb8zGn+gM+fgns0GC2a2sAVZtXpW6vzSvs5P/t7Mv P22cfKwqg3h2g58/UHgvqA483WddR+jQpzspPYhVLaTmJc9ckJeuA+oKmd/kkWR3BBcyBFR6c QJDLU1K8XVZhEcziLdUGYhh87Epb7cb+e5ZapHs27UBlgK3MPLrnUEtmBk4KoO0IUxMfxNT4g IO4aIK1qbRvyRoIjyWBKH6GX/WbBbKHuhMiYBBQcPgtwcwok3DtbkJv9kAflV/229SKgucobE MH7m5pov3rTW2KOVi/axNLCWcKL3354XqITdGbW4ILEmxrvvIwvY2zMYHIQKRByZamp29Go+7 eo+onupoc5pIMBlxpQ8sojbIlDptu8HHSnV02iT3q737lXEEl6xInA9Avtp44jGzzKxBUxWYE oqiq3vT 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: Markus Elfring Date: Fri, 10 Feb 2017 21:45:38 +0100 Replace the specification of a data structure by a reference to the desired member as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/hfi1/user_sdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index 5a73d738f2ba..da131a530b88 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c @@ -704,7 +704,9 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, /* Save all the IO vector structures */ for (i = 0; i < req->data_iovs; i++) { INIT_LIST_HEAD(&req->iovs[i].list); - memcpy(&req->iovs[i].iov, iovec + idx++, sizeof(struct iovec)); + memcpy(&req->iovs[i].iov, + iovec + idx++, + sizeof(req->iovs[i].iov)); ret = pin_vector_pages(req, &req->iovs[i]); if (ret) { req->status = ret;