From 07e56dc160d538ddcc71ad7276a9e3bbc8a407f9 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 17 Oct 2014 02:24:07 +0000 Subject: [PATCH] scst_vdisk: Reduce number of casts Since 'address' points at kernel space memory, change its type from uint8_t __user * into uint8_t *. This change reduces the number of casts between uint8_t __user * to uint8_t * in fileio_exec_write(). This patch does not change any functionality. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5848 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index a110e968c..895f04a59 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -5021,7 +5021,7 @@ static enum compl_status_e fileio_exec_write(struct vdisk_cmd_params *p) mm_segment_t old_fs; loff_t err = 0; ssize_t length, full_len; - uint8_t __user *address; + uint8_t *address; struct scst_vdisk_dev *virt_dev = cmd->dev->dh_priv; struct file *fd = virt_dev->fd; struct iovec *iv, *eiv; @@ -5039,7 +5039,7 @@ static enum compl_status_e fileio_exec_write(struct vdisk_cmd_params *p) if (iv == NULL) goto out_nomem; - length = scst_get_buf_first(cmd, (uint8_t __force **)&address); + length = scst_get_buf_first(cmd, &address); if (unlikely(length < 0)) { PRINT_ERROR("scst_get_buf_first() failed: %zd", length); scst_set_cmd_error(cmd, @@ -5058,12 +5058,11 @@ static enum compl_status_e fileio_exec_write(struct vdisk_cmd_params *p) full_len += length; i++; iv_count++; - iv[i].iov_base = address; + iv[i].iov_base = (uint8_t __force __user *)address; iv[i].iov_len = length; if (iv_count == UIO_MAXIOV) break; - length = scst_get_buf_next(cmd, - (uint8_t __force **)&address); + length = scst_get_buf_next(cmd, &address); } if (length == 0) { finished = true; @@ -5130,7 +5129,7 @@ restart: if (finished) break; - length = scst_get_buf_next(cmd, (uint8_t __force **)&address); + length = scst_get_buf_next(cmd, &address); } set_fs(old_fs);