From patchwork Sun Aug 18 18:28:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 2846220 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 46B269F271 for ; Sun, 18 Aug 2013 18:36:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1218920201 for ; Sun, 18 Aug 2013 18:36:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D85A120204 for ; Sun, 18 Aug 2013 18:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565Ab3HRSgB (ORCPT ); Sun, 18 Aug 2013 14:36:01 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:58344 "EHLO smtp1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754427Ab3HRSgB (ORCPT ); Sun, 18 Aug 2013 14:36:01 -0400 Received: from localhost.localdomain (unknown [IPv6:2a01:e35:2e9f:6ac0:f909:bc73:7b7d:1daf]) by smtp1-g21.free.fr (Postfix) with ESMTP id 19BCE940138; Sun, 18 Aug 2013 20:35:51 +0200 (CEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.7/8.14.7) with ESMTP id r7IITTbK032021; Sun, 18 Aug 2013 20:29:29 +0200 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.7/8.14.7/Submit) id r7IITT3X032020; Sun, 18 Aug 2013 20:29:29 +0200 From: Yann Droneaud To: linux-rdma@vger.kernel.org Cc: Yann Droneaud Subject: [PATCH 15/22] ucma: use size_t for userspace buffer input and output length Date: Sun, 18 Aug 2013 20:28:51 +0200 Message-Id: <2ae438b696c0778b91e9498b401994a58ca65e02.1376847403.git.ydroneaud@opteya.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's no reason to use a signed type for userspace buffer length. Signed-off-by: Yann Droneaud Link: http://mid.gmane.org/cover.1376847403.git.ydroneaud@opteya.com --- drivers/infiniband/core/ucma.c | 55 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index c653b1e..ecc6fad 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -290,7 +290,7 @@ out: } static ssize_t ucma_get_event(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct ucma_context *ctx; struct rdma_ucm_get_event cmd; @@ -369,7 +369,7 @@ static int ucma_get_qp_type(struct rdma_ucm_create_id *cmd, enum ib_qp_type *qp_ } static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_create_id cmd; struct rdma_ucm_create_id_resp resp; @@ -485,7 +485,7 @@ static int ucma_free_ctx(struct ucma_context *ctx) } static ssize_t ucma_destroy_id(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_destroy_id cmd; struct rdma_ucm_destroy_id_resp resp; @@ -522,7 +522,7 @@ static ssize_t ucma_destroy_id(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_bind_ip cmd; struct ucma_context *ctx; @@ -544,7 +544,7 @@ static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_bind cmd; struct sockaddr *addr; @@ -572,7 +572,7 @@ static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf, static ssize_t ucma_resolve_ip(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_resolve_ip cmd; struct ucma_context *ctx; @@ -597,7 +597,7 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file, static ssize_t ucma_resolve_addr(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_resolve_addr cmd; struct sockaddr *src, *dst; @@ -627,7 +627,7 @@ static ssize_t ucma_resolve_addr(struct ucma_file *file, static ssize_t ucma_resolve_route(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_resolve_route cmd; struct ucma_context *ctx; @@ -724,7 +724,7 @@ static void ucma_copy_iw_route(struct rdma_ucm_query_route_resp *resp, static ssize_t ucma_query_route(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_query cmd; struct rdma_ucm_query_route_resp resp; @@ -802,7 +802,7 @@ static void ucma_query_device_addr(struct rdma_cm_id *cm_id, } static ssize_t ucma_query_addr(struct ucma_context *ctx, - void __user *response, int out_len) + void __user *response, size_t out_len) { struct rdma_ucm_query_addr_resp resp; struct sockaddr *addr; @@ -830,7 +830,7 @@ static ssize_t ucma_query_addr(struct ucma_context *ctx, } static ssize_t ucma_query_path(struct ucma_context *ctx, - void __user *response, int out_len) + void __user *response, size_t out_len) { struct rdma_ucm_query_path_resp *resp; int i, ret = 0; @@ -865,7 +865,7 @@ static ssize_t ucma_query_path(struct ucma_context *ctx, } static ssize_t ucma_query_gid(struct ucma_context *ctx, - void __user *response, int out_len) + void __user *response, size_t out_len) { struct rdma_ucm_query_addr_resp resp; struct sockaddr_ib *addr; @@ -912,7 +912,7 @@ static ssize_t ucma_query_gid(struct ucma_context *ctx, static ssize_t ucma_query(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_query cmd; struct ucma_context *ctx; @@ -966,7 +966,7 @@ static void ucma_copy_conn_param(struct rdma_cm_id *id, } static ssize_t ucma_connect(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_connect cmd; struct rdma_conn_param conn_param; @@ -993,7 +993,7 @@ static ssize_t ucma_connect(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_listen cmd; struct ucma_context *ctx; @@ -1017,7 +1017,7 @@ static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_accept cmd; struct rdma_conn_param conn_param; @@ -1049,7 +1049,7 @@ static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_reject(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_reject cmd; struct ucma_context *ctx; @@ -1071,7 +1071,7 @@ static ssize_t ucma_reject(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_disconnect(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_disconnect cmd; struct ucma_context *ctx; @@ -1094,7 +1094,7 @@ static ssize_t ucma_disconnect(struct ucma_file *file, const char __user *inbuf, static ssize_t ucma_init_qp_attr(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_init_qp_attr cmd; struct ib_uverbs_qp_attr resp; @@ -1231,7 +1231,7 @@ static int ucma_set_option_level(struct ucma_context *ctx, int level, } static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_set_option cmd; struct ucma_context *ctx; @@ -1265,7 +1265,7 @@ out: } static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_notify cmd; struct ucma_context *ctx; @@ -1287,7 +1287,7 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf, } static ssize_t ucma_process_join(struct ucma_file *file, - struct rdma_ucm_join_mcast *cmd, int out_len) + struct rdma_ucm_join_mcast *cmd, size_t out_len) { struct rdma_ucm_create_id_resp resp; struct ucma_context *ctx; @@ -1347,7 +1347,7 @@ err1: static ssize_t ucma_join_ip_multicast(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_join_ip_mcast cmd; struct rdma_ucm_join_mcast join_cmd; @@ -1370,7 +1370,7 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file *file, static ssize_t ucma_join_multicast(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_join_mcast cmd; @@ -1385,7 +1385,7 @@ static ssize_t ucma_join_multicast(struct ucma_file *file, static ssize_t ucma_leave_multicast(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_destroy_id cmd; struct rdma_ucm_destroy_id_resp resp; @@ -1469,7 +1469,7 @@ static void ucma_move_events(struct ucma_context *ctx, struct ucma_file *file) static ssize_t ucma_migrate_id(struct ucma_file *new_file, const char __user *inbuf, - int in_len, int out_len) + size_t in_len, size_t out_len) { struct rdma_ucm_migrate_id cmd; struct rdma_ucm_migrate_resp resp; @@ -1533,7 +1533,8 @@ file_put: static ssize_t (*ucma_cmd_table[])(struct ucma_file *file, const char __user *inbuf, - int in_len, int out_len) = { + size_t in_len, size_t out_len) = { + [RDMA_USER_CM_CMD_CREATE_ID] = ucma_create_id, [RDMA_USER_CM_CMD_DESTROY_ID] = ucma_destroy_id, [RDMA_USER_CM_CMD_BIND_IP] = ucma_bind_ip,