From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Subject: [PATCH 5/5] IB/hfi1: Improve another size determination in hfi1_user_sdma_process_request() Date: Fri, 10 Feb 2017 22:05:40 +0100 Message-ID: References: <8a997282-09c7-0f9f-645e-d7c6e8c79e67@users.sourceforge.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <8a997282-09c7-0f9f-645e-d7c6e8c79e67-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Dennis Dalessandro , Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty Cc: LKML , kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-rdma@vger.kernel.org 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; -- 2.11.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788AbdBJVGn (ORCPT ); Fri, 10 Feb 2017 16:06:43 -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 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.11.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Fri, 10 Feb 2017 21:05:40 +0000 Subject: [PATCH 5/5] IB/hfi1: Improve another size determination in hfi1_user_sdma_process_request() Message-Id: List-Id: References: <8a997282-09c7-0f9f-645e-d7c6e8c79e67@users.sourceforge.net> In-Reply-To: <8a997282-09c7-0f9f-645e-d7c6e8c79e67-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Dennis Dalessandro , Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty Cc: LKML , kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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; -- 2.11.1