From patchwork Wed Nov 28 23:40:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Szilveszter_Sz=C3=A9kely?= X-Patchwork-Id: 1004943 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s4a91vBj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kooTq+ye"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434y054dKKz9s3l for ; Thu, 29 Nov 2018 10:43:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=oosGILrRlz402a6xopUcBfno1/1dxEhSBDisPdfls28=; b=s4a91vBjqliMAa aZ9G7u4QMudtql5PRUNhAHuANj6zexkC6zJicZziKjjvu4XitjRCHKb3PaotDB9pVhtYY/4Iq1WQ2 aAOOEwHBpnCj0b0jd++UCftfqfpQTakLynM5S8DKRg20LRPvf7fzAG/0dN1MsTogdSBKvQpL7Ko2D Bau318lhn3xh8heqdODKfIg29u0lmUVQzwDckT3HkaRFWii++w0kPFSAPK0FXv/qUhXXvZarzoCXk uM8WFmim2o7mkqL4Xoq9NC7GNWonvbiUsZyJ5xzVtjAVUSVpOW+QlQpONVvHjNCAkmIOl6Kxcfkon woTsYD1OyEhBmW4vk2VA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gS9UO-0001Ob-E9; Wed, 28 Nov 2018 23:43:28 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gS9UK-0001Nk-7L; Wed, 28 Nov 2018 23:43:25 +0000 Received: by mail-wm1-x341.google.com with SMTP id k198so386999wmd.3; Wed, 28 Nov 2018 15:43:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eFxFHAhxhJIs1y2b8RAt95A2ABOqjOFINkdabGLCjtE=; b=kooTq+yeafdgSYsMFGjkac1PuxTzQqMyqqC22B2gJam7FysNlJSMzvzNOIpJhEO9X6 wHDWEk+TLbvaWeYqhq4Gl6Sybp/5G24Y6N3zDeAZRPQIAsbPHZFN3oTGAN2GjJc/kmS7 R5tEDyX6R6+RxUqzh1nTGC0vzIZdr5edGHTn18Po3JMK/jC1CFKF6NZpJ8rQE8/N7OQs WdK88tCka1M5KSf/egGIHN1tZOAgpm16KdsFwgAc8OIkSn04y1NF8R2GlRmqaEtXoIyC 1FOn4NMuyakOj/kd+vcN6uSHVFW909vC0YoBUavsq7fbzM5CKkg7XL0xb2tB4WROEBog 4C0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eFxFHAhxhJIs1y2b8RAt95A2ABOqjOFINkdabGLCjtE=; b=oo5avOpP7SDFIbTaatHneB2tOkWX5JKtm+aye5revw2aoyFkU4IeGFXsjPaLQXhPFX XGIvBSYBcT29pfzacfZkmd25AXrzDlNT0XIfh7KUdknSkxlxYiIU7swXMN8lQ6QAvwD5 rN7KT15/W9exYZ2QsfGzwr66a+P+14RM/BUUalnbICxyhoo7OidtsEcgtF6kRR0twdyW qk1HUVeVyxJ/jYAK+Frq6Flu7QlzR+SB/ne/7/SpB9M5IEer8I4l4wg4Jz6HerZ6yW0C IBt5tQ2lWNcQU2URIUaP+ffInk1UviXLbVLVPqpENBerSOWZQQDxcfE7vridgKQsAVnT wrag== X-Gm-Message-State: AA+aEWZNQR4j09aeuGikrG2r+ijB7BiA5VPimQ5r0qXko/n5Z9gUdUfQ luTmxJumSACSwPSdNor/R14= X-Google-Smtp-Source: AFSGD/WEk8DlbZGxLBYIt68454QUehT3Fg8uB2ChJMTZ/Pk9kMS6LOFVZslxZRUwy/BcRlPgrVJDyg== X-Received: by 2002:a1c:f41:: with SMTP id 62mr4386530wmp.96.1543448591326; Wed, 28 Nov 2018 15:43:11 -0800 (PST) Received: from localhost.localdomain ([88.97.17.19]) by smtp.gmail.com with ESMTPSA id o81sm744845wmd.10.2018.11.28.15.43.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 15:43:10 -0800 (PST) From: =?utf-8?q?Szilveszter_Sz=C3=A9kely?= To: Subject: [PATCH] staging: vchiq_arm: add __user pointer annotations Date: Wed, 28 Nov 2018 23:40:32 +0000 Message-Id: <20181128234032.7170-1-szekelyszilv@gmail.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181128_154324_268093_DB06564D X-CRM114-Status: GOOD ( 12.72 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (szekelyszilv[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Stephen Rothwell , devel@driverdev.osuosl.org, =?utf-8?q?Szilves?= =?utf-8?q?zter_Sz=C3=A9kely?= , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Eric Anholt , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Add __user to pointers based on context and suggestions by sparse. Other sparse warnings still remain, in cases where more change would be required apart from adding __user. Signed-off-by: Szilveszter Székely --- .../interface/vchiq_arm/vchiq_arm.c | 28 +++++++++---------- .../interface/vchiq_arm/vchiq_if.h | 2 +- .../interface/vchiq_arm/vchiq_ioctl.h | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 0caee2d69..f28f68119 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1593,7 +1593,7 @@ vchiq_compat_ioctl_queue_message(struct file *file, unsigned long arg) { VCHIQ_QUEUE_MESSAGE_T *args; - struct vchiq_element *elements; + struct vchiq_element __user *elements; struct vchiq_queue_message32 args32; unsigned int count; @@ -1659,7 +1659,7 @@ vchiq_compat_ioctl_queue_bulk(struct file *file, unsigned int cmd, unsigned long arg) { - VCHIQ_QUEUE_BULK_TRANSFER_T *args; + VCHIQ_QUEUE_BULK_TRANSFER_T __user *args; struct vchiq_queue_bulk_transfer32 args32; struct vchiq_queue_bulk_transfer32 *ptrargs32 = (struct vchiq_queue_bulk_transfer32 *)arg; @@ -1725,16 +1725,16 @@ vchiq_compat_ioctl_await_completion(struct file *file, unsigned int cmd, unsigned long arg) { - VCHIQ_AWAIT_COMPLETION_T *args; - VCHIQ_COMPLETION_DATA_T *completion; + VCHIQ_AWAIT_COMPLETION_T __user *args; + VCHIQ_COMPLETION_DATA_T __user *completion; VCHIQ_COMPLETION_DATA_T completiontemp; struct vchiq_await_completion32 args32; struct vchiq_completion_data32 completion32; - unsigned int *msgbufcount32; + unsigned int __user *msgbufcount32; unsigned int msgbufcount_native; compat_uptr_t msgbuf32; - void *msgbuf; - void **msgbufptr; + void __user *msgbuf; + void * __user *msgbufptr; long ret; args = compat_alloc_user_space(sizeof(*args) + @@ -1743,11 +1743,11 @@ vchiq_compat_ioctl_await_completion(struct file *file, if (!args) return -EFAULT; - completion = (VCHIQ_COMPLETION_DATA_T *)(args + 1); - msgbufptr = (void __user **)(completion + 1); + completion = (VCHIQ_COMPLETION_DATA_T __user *)(args + 1); + msgbufptr = (void * __user *)(completion + 1); if (copy_from_user(&args32, - (struct vchiq_completion_data32 *)arg, + (struct vchiq_completion_data32 __user *)arg, sizeof(args32))) return -EFAULT; @@ -1875,7 +1875,7 @@ vchiq_compat_ioctl_dequeue_message(struct file *file, unsigned int cmd, unsigned long arg) { - VCHIQ_DEQUEUE_MESSAGE_T *args; + VCHIQ_DEQUEUE_MESSAGE_T __user *args; struct vchiq_dequeue_message32 args32; args = compat_alloc_user_space(sizeof(*args)); @@ -1883,7 +1883,7 @@ vchiq_compat_ioctl_dequeue_message(struct file *file, return -EFAULT; if (copy_from_user(&args32, - (struct vchiq_dequeue_message32 *)arg, + (struct vchiq_dequeue_message32 __user *)arg, sizeof(args32))) return -EFAULT; @@ -1910,7 +1910,7 @@ vchiq_compat_ioctl_get_config(struct file *file, unsigned int cmd, unsigned long arg) { - VCHIQ_GET_CONFIG_T *args; + VCHIQ_GET_CONFIG_T __user *args; struct vchiq_get_config32 args32; args = compat_alloc_user_space(sizeof(*args)); @@ -1918,7 +1918,7 @@ vchiq_compat_ioctl_get_config(struct file *file, return -EFAULT; if (copy_from_user(&args32, - (struct vchiq_get_config32 *)arg, + (struct vchiq_get_config32 __user *)arg, sizeof(args32))) return -EFAULT; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index 7b948a173..0cdaebee9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -87,7 +87,7 @@ typedef struct vchiq_header_struct { } VCHIQ_HEADER_T; struct vchiq_element { - const void *data; + const void __user *data; unsigned int size; }; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h index 9f859953f..858f46bd2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h @@ -50,7 +50,7 @@ typedef struct { typedef struct { unsigned int handle; unsigned int count; - const struct vchiq_element *elements; + const struct vchiq_element __user *elements; } VCHIQ_QUEUE_MESSAGE_T; typedef struct { @@ -85,7 +85,7 @@ typedef struct { typedef struct { unsigned int config_size; - VCHIQ_CONFIG_T *pconfig; + VCHIQ_CONFIG_T __user *pconfig; } VCHIQ_GET_CONFIG_T; typedef struct {