From patchwork Sun Aug 18 18:28:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 2846214 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 D701F9F271 for ; Sun, 18 Aug 2013 18:35:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 039E120212 for ; Sun, 18 Aug 2013 18:35:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 19E2220204 for ; Sun, 18 Aug 2013 18:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754497Ab3HRSfY (ORCPT ); Sun, 18 Aug 2013 14:35:24 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:56620 "EHLO smtp1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754427Ab3HRSfY (ORCPT ); Sun, 18 Aug 2013 14:35:24 -0400 Received: from localhost.localdomain (unknown [IPv6:2a01:e35:2e9f:6ac0:f909:bc73:7b7d:1daf]) by smtp1-g21.free.fr (Postfix) with ESMTP id 89C34940128; Sun, 18 Aug 2013 20:35:15 +0200 (CEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.7/8.14.7) with ESMTP id r7IITSus031989; Sun, 18 Aug 2013 20:29:28 +0200 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.7/8.14.7/Submit) id r7IITSEK031988; Sun, 18 Aug 2013 20:29:28 +0200 From: Yann Droneaud To: linux-rdma@vger.kernel.org Cc: Yann Droneaud Subject: [PATCH 07/22] ucm: changes ib_ucm_path_get() src arg to be a pointer Date: Sun, 18 Aug 2013 20:28:43 +0200 Message-Id: <662a8b92d9bd5bef52e90173ecda1cbfcbc4beb5.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 ib_icm_path_get() is a function that read data from userspace buffer. This patch makes 'src' argument to be an explicit pointer to userspace buffer, so that static analysis won't get fooled by 'src' being currently an integer without annotation. Signed-off-by: Yann Droneaud Link: http://mid.gmane.org/cover.1376847403.git.ydroneaud@opteya.com --- drivers/infiniband/core/ucm.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index d336a1b..b53e59b 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c @@ -702,7 +702,7 @@ static int ib_ucm_alloc_data(const void **dest, const void __user *src, u32 len) return 0; } -static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src) +static int ib_ucm_path_get(struct ib_sa_path_rec **path, const void __user *src) { struct ib_user_path_rec upath; struct ib_sa_path_rec *sa_path; @@ -716,8 +716,7 @@ static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src) if (!sa_path) return -ENOMEM; - if (copy_from_user(&upath, (void __user *)(unsigned long)src, - sizeof(upath))) { + if (copy_from_user(&upath, src, sizeof(upath))) { kfree(sa_path); return -EFAULT; @@ -750,11 +749,13 @@ static ssize_t ib_ucm_send_req(struct ib_ucm_file *file, if (result) goto done; - result = ib_ucm_path_get(¶m.primary_path, cmd.primary_path); + result = ib_ucm_path_get(¶m.primary_path, + (const void __user *)(unsigned long)cmd.primary_path); if (result) goto done; - result = ib_ucm_path_get(¶m.alternate_path, cmd.alternate_path); + result = ib_ucm_path_get(¶m.alternate_path, + (const void __user *)(unsigned long)cmd.alternate_path); if (result) goto done; @@ -988,7 +989,8 @@ static ssize_t ib_ucm_send_lap(struct ib_ucm_file *file, if (result) goto done; - result = ib_ucm_path_get(&path, cmd.path); + result = ib_ucm_path_get(&path, + (const void __user *)(unsigned long)cmd.path); if (result) goto done; @@ -1026,7 +1028,8 @@ static ssize_t ib_ucm_send_sidr_req(struct ib_ucm_file *file, if (result) goto done; - result = ib_ucm_path_get(¶m.path, cmd.path); + result = ib_ucm_path_get(¶m.path, + (const void __user *)(unsigned long)cmd.path); if (result) goto done;