From nobody Tue Dec 16 14:49:37 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FFD01E2309 for ; Tue, 14 Jan 2025 16:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736873663; cv=none; b=JMY4l9F4mT1H8g8wbdlGWzLPxXW3Wwww+uSxA73Uc/4U01q2NtRml5MwRtf1yPgQ8QtifslLglKBQ1g831sfzH/G0ygInZ1XqaprSfmmmnT4DVKFd8I7RKUSdtED6Z1V+LG4HAZZOl6uJ9S3UT7/URQxCQtvEzYU5fqYTBTPtuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736873663; c=relaxed/simple; bh=Be+bhLKy0crE6GQjdraRet5wldeI7lbH2MQYS0Ehcks=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SMKwnHxrujzrcP0pxcwItK711WbupH1R7+pk1uFXnRv7u5m/gOjZxuWTePhcBFW3Z5GYLSItM2uouxOkB74FOcF2b8Rn+AlI9/NsIhTNWuxHAuRZLmedkjPT3AClawmlfykgS6hcvPlcq2u1LCogsyFGkfUaMRVonPqe1hTshfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hDKnxaF/; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hDKnxaF/" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43675b1155bso65419685e9.2 for ; Tue, 14 Jan 2025 08:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736873659; x=1737478459; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JJeBiGNKF3n1GikbnwHTwsdqGW+BvczoYjInXjW5HTE=; b=hDKnxaF/n4AiWLnKOqgfxo0OvxSDP5JvuBiCymMFmEcN5kBvRHXwK7S7sKwZt20cTC 3O2FYs9PRe7llF1mb0+3g1aG6oFySx4cMh8VMskQGkemmI9oaYb4mgHjubuKaA5LZk9Y GXC6Zjx2DBdGmZdyQwO2wQ4DGawoKx9t7NpuCvTUhMYV6N1C0cNLCkcLjsrbnYd2EDnF LqxIKSUrrTwut1P+5b061oBdc7ej1BZ4+1qkighgkFWwt3XCyrfpsVTGQ9BWz8dmp+tF U+S6K4KADqTyv5eIpi3WPVj6cBFAd7rDSmqjCzsz886/p9vSHw93t13mU0V3kZ9Izx54 bDtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736873659; x=1737478459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJeBiGNKF3n1GikbnwHTwsdqGW+BvczoYjInXjW5HTE=; b=kptmB9SeB8yEOAhSO8OQVbjhmGbjZoBV76R+uKqj7ynmb1O8XsB00z53uGa6GxGkfx C0SpRpkhBQNxTumks4dPrvdNEWzxqduNtp5YmewVM1RH5GTMFO7OEPykaeqNBsB7ebep weLO82iK9lRPK4JOZ8clt2xw8KoiOhalMc9+lg6SBobDR+bLiTEv+qCoyVdTH6tCeWb5 N5qeVR4c1mn8swkAmGTVIvMDKmbkbISe+PGxFGUCl5Iuu1BpG1yHvVzZiKycdMTXTY1Y Oya+TVvMzEL8HtkbANsSSqMzU0Ls5Z7BLkruooPor+MOqDPKC5Q6K6RuBNVv/1v+2eNm revw== X-Forwarded-Encrypted: i=1; AJvYcCWK+LaWSjgDFWdt9R8V3MAr9c9ER8WWTdSv95piKXi3Jz3JbDmT2u7X8K/07GH4WQfwddLTBagQdKbZno0=@vger.kernel.org X-Gm-Message-State: AOJu0YxZTFMO21VHeVhWzDDEobUT2mw7VJApRhXccMKaSILpZ/R0EyHg x02WvF4nZcBYG+EvMI6je4TnCE1R80bUfms8nKBNc34kwPWALEUf X-Gm-Gg: ASbGnctsukfYR5BvOzRWcxNmb0eukwYz65TXjj0l6etSPFsdDUeF3pWINcKcEgfXmno nmq73KVDcDyakXMK7LUGSlNL657yZzkip5K+YAvfX/o4zsIzySOIRQFaTE/iqi3NilZnkTk0ojq haXPThGe//gEsqOQ/w0LiKwu+V/m14NpJzUORJUGMMwmlVKwDAz3ctEQwY7dJnVoOFGiG27tCvF +dgrJNq5gz9ydyHmrCp3r6l7orL7eRHvuAeQOjxcqSc8gdpQ56V4c1AwHIf4KVxrHFspAQIsI4q PhQ8zmS3QsAh1tj7 X-Google-Smtp-Source: AGHT+IFdB9MqijzvMQ5AZN705AacNdKytLYsKY/BtzcJq/+83dVI1n8c+vx49QEbbVjA9ZpB/+dcOw== X-Received: by 2002:a05:6000:4617:b0:385:f220:f779 with SMTP id ffacd0b85a97d-38a873392e7mr21372723f8f.49.1736873659081; Tue, 14 Jan 2025 08:54:19 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9e03e5fsm179930495e9.18.2025.01.14.08.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 08:54:18 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Dave Penkler Subject: [PATCH 2/4] staging: gpib: Use __user for user space pointers Date: Tue, 14 Jan 2025 17:54:01 +0100 Message-ID: <20250114165403.16410-3-dpenkler@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114165403.16410-1-dpenkler@gmail.com> References: <20250114165403.16410-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The user buffers in copy_from_user, copy_to_user and some file ops did not use the __user address space attribute. This led to the following sparse warning, for example: common/gpib_os.c:838:40: warning: incorrect type in argument 2 (different a= ddress spaces) common/gpib_os.c:838:40: expected void const [noderef] __user *from common/gpib_os.c:838:40: got void * Add the __user address space attribute where needed. Signed-off-by: Dave Penkler --- drivers/staging/gpib/common/gpib_os.c | 103 +++++++++--------- .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 4 +- 2 files changed, 54 insertions(+), 53 deletions(-) diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/c= ommon/gpib_os.c index 982a2fe68cf2..69fe39aa0daf 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -835,7 +835,7 @@ static int board_type_ioctl(gpib_file_private_t *file_p= riv, gpib_board_t *board, return -EBUSY; } =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(board_type_ioctl_t)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(board_type_ioc= tl_t)); if (retval) return retval; =20 @@ -879,7 +879,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, g= pib_board_t *board, unsigned long arg) { read_write_ioctl_t read_cmd; - u8 *userbuf; + u8 __user *userbuf; unsigned long remain; int end_flag =3D 0; int retval; @@ -887,7 +887,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, g= pib_board_t *board, gpib_descriptor_t *desc; size_t nbytes; =20 - retval =3D copy_from_user(&read_cmd, (void *)arg, sizeof(read_cmd)); + retval =3D copy_from_user(&read_cmd, (void __user *)arg, sizeof(read_cmd)= ); if (retval) return -EFAULT; =20 @@ -901,7 +901,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, g= pib_board_t *board, if (WARN_ON_ONCE(sizeof(userbuf) > sizeof(read_cmd.buffer_ptr))) return -EFAULT; =20 - userbuf =3D (u8 *)(unsigned long)read_cmd.buffer_ptr; + userbuf =3D (u8 __user *)(unsigned long)read_cmd.buffer_ptr; userbuf +=3D read_cmd.completed_transfer_count; =20 remain =3D read_cmd.requested_transfer_count - read_cmd.completed_transfe= r_count; @@ -939,7 +939,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, g= pib_board_t *board, if (remain =3D=3D 0 || end_flag) read_ret =3D 0; if (retval =3D=3D 0) - retval =3D copy_to_user((void *)arg, &read_cmd, sizeof(read_cmd)); + retval =3D copy_to_user((void __user *)arg, &read_cmd, sizeof(read_cmd)); =20 atomic_set(&desc->io_in_progress, 0); =20 @@ -954,7 +954,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, unsigned long arg) { read_write_ioctl_t cmd; - u8 *userbuf; + u8 __user *userbuf; unsigned long remain; int retval; int fault =3D 0; @@ -962,7 +962,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, size_t bytes_written; int no_clear_io_in_prog; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -973,7 +973,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, if (!desc) return -EINVAL; =20 - userbuf =3D (u8 *)(unsigned long)cmd.buffer_ptr; + userbuf =3D (u8 __user *)(unsigned long)cmd.buffer_ptr; userbuf +=3D cmd.completed_transfer_count; =20 no_clear_io_in_prog =3D cmd.end; @@ -1016,7 +1016,7 @@ static int command_ioctl(gpib_file_private_t *file_pr= iv, cmd.completed_transfer_count =3D cmd.requested_transfer_count - remain; =20 if (fault =3D=3D 0) - fault =3D copy_to_user((void *)arg, &cmd, sizeof(cmd)); + fault =3D copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); =20 /* * no_clear_io_in_prog (cmd.end) is true when io_in_progress should @@ -1038,13 +1038,13 @@ static int write_ioctl(gpib_file_private_t *file_pr= iv, gpib_board_t *board, unsigned long arg) { read_write_ioctl_t write_cmd; - u8 *userbuf; + u8 __user *userbuf; unsigned long remain; int retval =3D 0; int fault; gpib_descriptor_t *desc; =20 - fault =3D copy_from_user(&write_cmd, (void *)arg, sizeof(write_cmd)); + fault =3D copy_from_user(&write_cmd, (void __user *)arg, sizeof(write_cmd= )); if (fault) return -EFAULT; =20 @@ -1055,7 +1055,7 @@ static int write_ioctl(gpib_file_private_t *file_priv= , gpib_board_t *board, if (!desc) return -EINVAL; =20 - userbuf =3D (u8 *)(unsigned long)write_cmd.buffer_ptr; + userbuf =3D (u8 __user *)(unsigned long)write_cmd.buffer_ptr; userbuf +=3D write_cmd.completed_transfer_count; =20 remain =3D write_cmd.requested_transfer_count - write_cmd.completed_trans= fer_count; @@ -1094,7 +1094,7 @@ static int write_ioctl(gpib_file_private_t *file_priv= , gpib_board_t *board, if (remain =3D=3D 0) retval =3D 0; if (fault =3D=3D 0) - fault =3D copy_to_user((void *)arg, &write_cmd, sizeof(write_cmd)); + fault =3D copy_to_user((void __user *)arg, &write_cmd, sizeof(write_cmd)= ); =20 atomic_set(&desc->io_in_progress, 0); =20 @@ -1111,7 +1111,7 @@ static int status_bytes_ioctl(gpib_board_t *board, un= signed long arg) spoll_bytes_ioctl_t cmd; int retval; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1121,7 +1121,7 @@ static int status_bytes_ioctl(gpib_board_t *board, un= signed long arg) else cmd.num_bytes =3D num_status_bytes(device); =20 - retval =3D copy_to_user((void *)arg, &cmd, sizeof(cmd)); + retval =3D copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1231,7 +1231,7 @@ static int open_dev_ioctl(struct file *filep, gpib_bo= ard_t *board, unsigned long gpib_file_private_t *file_priv =3D filep->private_data; int i; =20 - retval =3D copy_from_user(&open_dev_cmd, (void *)arg, sizeof(open_dev_cmd= )); + retval =3D copy_from_user(&open_dev_cmd, (void __user *)arg, sizeof(open_= dev_cmd)); if (retval) return -EFAULT; =20 @@ -1267,7 +1267,7 @@ static int open_dev_ioctl(struct file *filep, gpib_bo= ard_t *board, unsigned long atomic_set(&board->stuck_srq, 0); =20 open_dev_cmd.handle =3D i; - retval =3D copy_to_user((void *)arg, &open_dev_cmd, sizeof(open_dev_cmd)); + retval =3D copy_to_user((void __user *)arg, &open_dev_cmd, sizeof(open_de= v_cmd)); if (retval) return -EFAULT; =20 @@ -1280,7 +1280,7 @@ static int close_dev_ioctl(struct file *filep, gpib_b= oard_t *board, unsigned lon gpib_file_private_t *file_priv =3D filep->private_data; int retval; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1308,7 +1308,7 @@ static int serial_poll_ioctl(gpib_board_t *board, uns= igned long arg) =20 dev_dbg(board->gpib_dev, "pid %i, entering %s()\n", current->pid, __func_= _); =20 - retval =3D copy_from_user(&serial_cmd, (void *)arg, sizeof(serial_cmd)); + retval =3D copy_from_user(&serial_cmd, (void __user *)arg, sizeof(serial_= cmd)); if (retval) return -EFAULT; =20 @@ -1317,7 +1317,7 @@ static int serial_poll_ioctl(gpib_board_t *board, uns= igned long arg) if (retval < 0) return retval; =20 - retval =3D copy_to_user((void *)arg, &serial_cmd, sizeof(serial_cmd)); + retval =3D copy_to_user((void __user *)arg, &serial_cmd, sizeof(serial_cm= d)); if (retval) return -EFAULT; =20 @@ -1331,7 +1331,7 @@ static int wait_ioctl(gpib_file_private_t *file_priv,= gpib_board_t *board, int retval; gpib_descriptor_t *desc; =20 - retval =3D copy_from_user(&wait_cmd, (void *)arg, sizeof(wait_cmd)); + retval =3D copy_from_user(&wait_cmd, (void __user *)arg, sizeof(wait_cmd)= ); if (retval) return -EFAULT; =20 @@ -1344,7 +1344,7 @@ static int wait_ioctl(gpib_file_private_t *file_priv,= gpib_board_t *board, if (retval < 0) return retval; =20 - retval =3D copy_to_user((void *)arg, &wait_cmd, sizeof(wait_cmd)); + retval =3D copy_to_user((void __user *)arg, &wait_cmd, sizeof(wait_cmd)); if (retval) return -EFAULT; =20 @@ -1360,7 +1360,7 @@ static int parallel_poll_ioctl(gpib_board_t *board, u= nsigned long arg) if (retval < 0) return retval; =20 - retval =3D copy_to_user((void *)arg, &poll_byte, sizeof(poll_byte)); + retval =3D copy_to_user((void __user *)arg, &poll_byte, sizeof(poll_byte)= ); if (retval) return -EFAULT; =20 @@ -1371,14 +1371,14 @@ static int online_ioctl(gpib_board_t *board, unsign= ed long arg) { online_ioctl_t online_cmd; int retval; - void *init_data =3D NULL; + void __user *init_data =3D NULL; =20 board->config.init_data =3D NULL; =20 if (!capable(CAP_SYS_ADMIN)) return -EPERM; =20 - retval =3D copy_from_user(&online_cmd, (void *)arg, sizeof(online_cmd)); + retval =3D copy_from_user(&online_cmd, (void __user *)arg, sizeof(online_= cmd)); if (retval) return -EFAULT; if (online_cmd.init_data_length > 0) { @@ -1387,7 +1387,7 @@ static int online_ioctl(gpib_board_t *board, unsigned= long arg) return -ENOMEM; if (WARN_ON_ONCE(sizeof(init_data) > sizeof(online_cmd.init_data_ptr))) return -EFAULT; - init_data =3D (void *)(unsigned long)(online_cmd.init_data_ptr); + init_data =3D (void __user *)(unsigned long)(online_cmd.init_data_ptr); retval =3D copy_from_user(board->config.init_data, init_data, online_cmd.init_data_length); if (retval) { @@ -1416,7 +1416,7 @@ static int remote_enable_ioctl(gpib_board_t *board, u= nsigned long arg) int enable; int retval; =20 - retval =3D copy_from_user(&enable, (void *)arg, sizeof(enable)); + retval =3D copy_from_user(&enable, (void __user *)arg, sizeof(enable)); if (retval) return -EFAULT; =20 @@ -1428,7 +1428,7 @@ static int take_control_ioctl(gpib_board_t *board, un= signed long arg) int synchronous; int retval; =20 - retval =3D copy_from_user(&synchronous, (void *)arg, sizeof(synchronous)); + retval =3D copy_from_user(&synchronous, (void __user *)arg, sizeof(synchr= onous)); if (retval) return -EFAULT; =20 @@ -1444,7 +1444,7 @@ static int line_status_ioctl(gpib_board_t *board, uns= igned long arg) if (retval < 0) return retval; =20 - retval =3D copy_to_user((void *)arg, &lines, sizeof(lines)); + retval =3D copy_to_user((void __user *)arg, &lines, sizeof(lines)); if (retval) return -EFAULT; =20 @@ -1458,7 +1458,7 @@ static int pad_ioctl(gpib_board_t *board, gpib_file_p= rivate_t *file_priv, int retval; gpib_descriptor_t *desc; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1494,7 +1494,7 @@ static int sad_ioctl(gpib_board_t *board, gpib_file_p= rivate_t *file_priv, int retval; gpib_descriptor_t *desc; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1527,7 +1527,7 @@ static int eos_ioctl(gpib_board_t *board, unsigned lo= ng arg) eos_ioctl_t eos_cmd; int retval; =20 - retval =3D copy_from_user(&eos_cmd, (void *)arg, sizeof(eos_cmd)); + retval =3D copy_from_user(&eos_cmd, (void __user *)arg, sizeof(eos_cmd)); if (retval) return -EFAULT; =20 @@ -1539,7 +1539,7 @@ static int request_service_ioctl(gpib_board_t *board,= unsigned long arg) u8 status_byte; int retval; =20 - retval =3D copy_from_user(&status_byte, (void *)arg, sizeof(status_byte)); + retval =3D copy_from_user(&status_byte, (void __user *)arg, sizeof(status= _byte)); if (retval) return -EFAULT; =20 @@ -1551,7 +1551,8 @@ static int request_service2_ioctl(gpib_board_t *board= , unsigned long arg) request_service2_t request_service2_cmd; int retval; =20 - retval =3D copy_from_user(&request_service2_cmd, (void *)arg, sizeof(requ= est_service2_t)); + retval =3D copy_from_user(&request_service2_cmd, (void __user *)arg, + sizeof(request_service2_t)); if (retval) return -EFAULT; =20 @@ -1567,7 +1568,7 @@ static int iobase_ioctl(gpib_board_config_t *config, = unsigned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; =20 - retval =3D copy_from_user(&base_addr, (void *)arg, sizeof(base_addr)); + retval =3D copy_from_user(&base_addr, (void __user *)arg, sizeof(base_add= r)); if (retval) return -EFAULT; =20 @@ -1586,7 +1587,7 @@ static int irq_ioctl(gpib_board_config_t *config, uns= igned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; =20 - retval =3D copy_from_user(&irq, (void *)arg, sizeof(irq)); + retval =3D copy_from_user(&irq, (void __user *)arg, sizeof(irq)); if (retval) return -EFAULT; =20 @@ -1603,7 +1604,7 @@ static int dma_ioctl(gpib_board_config_t *config, uns= igned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; =20 - retval =3D copy_from_user(&dma_channel, (void *)arg, sizeof(dma_channel)); + retval =3D copy_from_user(&dma_channel, (void __user *)arg, sizeof(dma_ch= annel)); if (retval) return -EFAULT; =20 @@ -1619,7 +1620,7 @@ static int autospoll_ioctl(gpib_board_t *board, gpib_= file_private_t *file_priv, int retval; gpib_descriptor_t *desc; =20 - retval =3D copy_from_user(&enable, (void *)arg, sizeof(enable)); + retval =3D copy_from_user(&enable, (void __user *)arg, sizeof(enable)); if (retval) return -EFAULT; =20 @@ -1654,7 +1655,7 @@ static int mutex_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, { int retval, lock_mutex; =20 - retval =3D copy_from_user(&lock_mutex, (void *)arg, sizeof(lock_mutex)); + retval =3D copy_from_user(&lock_mutex, (void __user *)arg, sizeof(lock_mu= tex)); if (retval) return -EFAULT; =20 @@ -1698,7 +1699,7 @@ static int timeout_ioctl(gpib_board_t *board, unsigne= d long arg) unsigned int timeout; int retval; =20 - retval =3D copy_from_user(&timeout, (void *)arg, sizeof(timeout)); + retval =3D copy_from_user(&timeout, (void __user *)arg, sizeof(timeout)); if (retval) return -EFAULT; =20 @@ -1713,7 +1714,7 @@ static int ppc_ioctl(gpib_board_t *board, unsigned lo= ng arg) ppoll_config_ioctl_t cmd; int retval; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1739,7 +1740,7 @@ static int set_local_ppoll_mode_ioctl(gpib_board_t *b= oard, unsigned long arg) local_ppoll_mode_ioctl_t cmd; int retval; =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1759,7 +1760,7 @@ static int get_local_ppoll_mode_ioctl(gpib_board_t *b= oard, unsigned long arg) int retval; =20 cmd =3D board->local_ppoll_mode; - retval =3D copy_to_user((void *)arg, &cmd, sizeof(cmd)); + retval =3D copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); if (retval) return -EFAULT; =20 @@ -1773,7 +1774,7 @@ static int query_board_rsv_ioctl(gpib_board_t *board,= unsigned long arg) =20 status =3D board->interface->serial_poll_status(board); =20 - retval =3D copy_to_user((void *)arg, &status, sizeof(status)); + retval =3D copy_to_user((void __user *)arg, &status, sizeof(status)); if (retval) return -EFAULT; =20 @@ -1796,7 +1797,7 @@ static int board_info_ioctl(const gpib_board_t *board= , unsigned long arg) info.t1_delay =3D board->t1_nano_sec; info.ist =3D board->ist; info.no_7_bit_eos =3D board->interface->no_7_bit_eos; - retval =3D copy_to_user((void *)arg, &info, sizeof(info)); + retval =3D copy_to_user((void __user *)arg, &info, sizeof(info)); if (retval) return -EFAULT; =20 @@ -1808,7 +1809,7 @@ static int interface_clear_ioctl(gpib_board_t *board,= unsigned long arg) unsigned int usec_duration; int retval; =20 - retval =3D copy_from_user(&usec_duration, (void *)arg, sizeof(usec_durati= on)); + retval =3D copy_from_user(&usec_duration, (void __user *)arg, sizeof(usec= _duration)); if (retval) return -EFAULT; =20 @@ -1823,7 +1824,7 @@ static int select_pci_ioctl(gpib_board_config_t *conf= ig, unsigned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; =20 - retval =3D copy_from_user(&selection, (void *)arg, sizeof(selection)); + retval =3D copy_from_user(&selection, (void __user *)arg, sizeof(selectio= n)); if (retval) return -EFAULT; =20 @@ -1845,7 +1846,7 @@ static int select_device_path_ioctl(gpib_board_config= _t *config, unsigned long a if (!selection) return -ENOMEM; =20 - retval =3D copy_from_user(selection, (void *)arg, sizeof(select_device_pa= th_ioctl_t)); + retval =3D copy_from_user(selection, (void __user *)arg, sizeof(select_de= vice_path_ioctl_t)); if (retval) { vfree(selection); return -EFAULT; @@ -1979,7 +1980,7 @@ static int event_ioctl(gpib_board_t *board, unsigned = long arg) =20 user_event =3D event; =20 - retval =3D copy_to_user((void *)arg, &user_event, sizeof(user_event)); + retval =3D copy_to_user((void __user *)arg, &user_event, sizeof(user_even= t)); if (retval) return -EFAULT; =20 @@ -1991,7 +1992,7 @@ static int request_system_control_ioctl(gpib_board_t = *board, unsigned long arg) rsc_ioctl_t request_control; int retval; =20 - retval =3D copy_from_user(&request_control, (void *)arg, sizeof(request_c= ontrol)); + retval =3D copy_from_user(&request_control, (void __user *)arg, sizeof(re= quest_control)); if (retval) return -EFAULT; =20 @@ -2011,7 +2012,7 @@ static int t1_delay_ioctl(gpib_board_t *board, unsign= ed long arg) return -EIO; } =20 - retval =3D copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval =3D copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; =20 diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/s= taging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index b0bde6c3458c..85322af62c23 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -1880,7 +1880,7 @@ static int skel_release(struct inode *inode, struct f= ile *file) * user space access to read function */ =20 -static ssize_t skel_read(struct file *file, char *buffer, size_t count, +static ssize_t skel_read(struct file *file, char __user *buffer, size_t co= unt, loff_t *ppos) { struct usb_skel *dev; @@ -1911,7 +1911,7 @@ static ssize_t skel_read(struct file *file, char *buf= fer, size_t count, * user space access to write function */ =20 -static ssize_t skel_write(struct file *file, const char *user_buffer, +static ssize_t skel_write(struct file *file, const char __user *user_buffe= r, size_t count, loff_t *ppos) { struct usb_skel *dev; --=20 2.47.1