int buff_size; // size of the buffer for the request
char resp_buff[RESPBUFFSIZE];
int resp_buff_size;
- char * resp_addr; // address of response in user space
+ char __user * resp_addr; // address of response in user space
unsigned int funccode; // function code of request
wait_queue_head_t waitq;
unsigned long requestsent; // time at which the request was sent
*/
static int z90crypt_open(struct inode *, struct file *);
static int z90crypt_release(struct inode *, struct file *);
-static ssize_t z90crypt_read(struct file *, char *, size_t, loff_t *);
-static ssize_t z90crypt_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t z90crypt_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t z90crypt_write(struct file *, const char __user *,
+ size_t, loff_t *);
static int z90crypt_ioctl(struct inode *, struct file *,
unsigned int, unsigned long);
static void z90crypt_cleanup_task(unsigned long);
static int z90crypt_status(char *, char **, off_t, int, int *, void *);
-static int z90crypt_status_write(struct file *, const char *,
+static int z90crypt_status_write(struct file *, const char __user *,
unsigned long, void *);
/**
trans_modexpo32(unsigned int fd, unsigned int cmd, unsigned long arg,
struct file *file)
{
- struct ica_rsa_modexpo_32 *mex32u = compat_ptr(arg);
+ struct ica_rsa_modexpo_32 __user *mex32u = compat_ptr(arg);
struct ica_rsa_modexpo_32 mex32k;
- struct ica_rsa_modexpo *mex64;
+ struct ica_rsa_modexpo __user *mex64;
int ret = 0;
unsigned int i;
trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg,
struct file *file)
{
- struct ica_rsa_modexpo_crt_32 *crt32u = compat_ptr(arg);
+ struct ica_rsa_modexpo_crt_32 __user *crt32u = compat_ptr(arg);
struct ica_rsa_modexpo_crt_32 crt32k;
- struct ica_rsa_modexpo_crt *crt64;
+ struct ica_rsa_modexpo_crt __user *crt64;
int ret = 0;
unsigned int i;
* z90crypt_read will not be supported beyond z90crypt 1.3.1
*/
static ssize_t
-z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
+z90crypt_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
{
PDEBUG("filp %p (PID %d)\n", filp, PID());
return -EPERM;
*/
#include <linux/random.h>
static ssize_t
-z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
+z90crypt_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
{
unsigned char *temp_buff;
* Write is is not allowed
*/
static ssize_t
-z90crypt_write(struct file *filp, const char *buf, size_t count, loff_t *f_pos)
+z90crypt_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
{
PDEBUG("filp %p (PID %d)\n", filp, PID());
return -EPERM;
* process_results copies the user's work from kernel space.
*/
static inline int
-z90crypt_process_results(struct work_element *we_p, char *buf)
+z90crypt_process_results(struct work_element *we_p, char __user *buf)
{
int rv;
static inline int
z90crypt_prepare(struct work_element *we_p, unsigned int funccode,
- const char *buffer)
+ const char __user *buffer)
{
int rv;
PDEBUG("PID %d: allocate_work_element returned ENOMEM\n", pid);
return rv;
}
- if ((rv = z90crypt_prepare(we_p, cmd, (const char *)arg)))
+ if ((rv = z90crypt_prepare(we_p, cmd, (const char __user *)arg)))
PDEBUG("PID %d: rv = %d from z90crypt_prepare\n", pid, rv);
if (!rv)
if ((rv = z90crypt_send(we_p, (const char *)arg)))
rv = we_p->retcode;
}
if (!rv)
- rv = z90crypt_process_results(we_p, (char *)arg);
+ rv = z90crypt_process_results(we_p, (char __user *)arg);
if ((we_p->status[0] & STAT_FAILED)) {
switch (rv) {
case Z90STAT_TOTALCOUNT:
tempstat = get_status_totalcount();
- if (copy_to_user((int *)arg, &tempstat,sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat,sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_PCICACOUNT:
tempstat = get_status_PCICAcount();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_PCICCCOUNT:
tempstat = get_status_PCICCcount();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_PCIXCCCOUNT:
tempstat = get_status_PCIXCCcount();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_REQUESTQ_COUNT:
tempstat = get_status_requestq_count();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_PENDINGQ_COUNT:
tempstat = get_status_pendingq_count();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_TOTALOPEN_COUNT:
tempstat = get_status_totalopen_count();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
case Z90STAT_DOMAIN_INDEX:
tempstat = get_status_domain_index();
- if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+ if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
ret = -EFAULT;
break;
break;
}
get_status_status_mask(status);
- if (copy_to_user((char *) arg, status, Z90CRYPT_NUM_APS) != 0)
+ if (copy_to_user((char __user *) arg, status, Z90CRYPT_NUM_APS)
+ != 0)
ret = -EFAULT;
kfree(status);
break;
break;
}
get_status_qdepth_mask(qdepth);
- if (copy_to_user((char *) arg, qdepth, Z90CRYPT_NUM_APS) != 0)
+ if (copy_to_user((char __user *) arg, qdepth, Z90CRYPT_NUM_APS) != 0)
ret = -EFAULT;
kfree(qdepth);
break;
break;
}
get_status_perdevice_reqcnt(reqcnt);
- if (copy_to_user((char *) arg, reqcnt,
+ if (copy_to_user((char __user *) arg, reqcnt,
Z90CRYPT_NUM_APS * sizeof(int)) != 0)
ret = -EFAULT;
kfree(reqcnt);
get_status_status_mask(pstat->status);
get_status_qdepth_mask(pstat->qdepth);
- if (copy_to_user((struct ica_z90_status *) arg, pstat,
+ if (copy_to_user((struct ica_z90_status __user *) arg, pstat,
sizeof(struct ica_z90_status)) != 0)
ret = -EFAULT;
kfree(pstat);
}
static int
-z90crypt_status_write(struct file *file, const char *buffer,
+z90crypt_status_write(struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
int i, j, len, offs, found, eof;
*/
static inline int
receive_from_crypto_device(int index, unsigned char *psmid, int *buff_len_p,
- unsigned char *buff, unsigned char **dest_p_p)
+ unsigned char *buff, unsigned char __user **dest_p_p)
{
int dv, rv;
struct device *dev_ptr;
static inline void
helper_handle_work_element(int index, unsigned char psmid[8], int rc,
int buff_len, unsigned char *buff,
- unsigned char *resp_addr)
+ unsigned char __user *resp_addr)
{
struct work_element *pq_p;
struct list_head *lptr, *tptr;
z90crypt_reader_task(unsigned long ptr)
{
int workavail, remaining, index, rc, buff_len;
- unsigned char psmid[8], *resp_addr;
+ unsigned char psmid[8];
+ unsigned char __user *resp_addr;
static unsigned char buff[1024];
PDEBUG("jiffies %ld\n", jiffies);