pid_t gl_nNotifyTgid;
EXPORT_SYMBOL_GPL(gl_nNotifyTgid);
-DECLARE_WAIT_QUEUE_HEAD (notification_waiters_queue);
-volatile unsigned notification_count;
+static DECLARE_WAIT_QUEUE_HEAD (notification_waiters_queue);
+static volatile unsigned notification_count;
static int device_mmap (struct file *filp, struct vm_area_struct *vma);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#endif
static int device_open(struct inode *, struct file *);
static int device_release(struct inode *, struct file *);
-static ssize_t device_read(struct file *, char *, size_t, loff_t *);
-static ssize_t device_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t device_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t device_write(struct file *, const char __user *, size_t, loff_t *);
static int gl_nDeviceOpened = 0;
static struct file_operations device_fops = {
.release = device_release
};
-typedef void (* dbi_module_callback)();
+typedef void (* dbi_module_callback)(void);
int device_init (void)
{
return 0;
}
-static ssize_t device_read(struct file *filp, char *buffer, size_t length, loff_t * offset)
+static ssize_t device_read(struct file *filp, char __user *buffer, size_t length, loff_t * offset)
{
EPRINTF("Operation <<read>> not supported!");
return -1;
}
-static ssize_t device_write(struct file *filp, const char *buff, size_t len, loff_t * off)
+static ssize_t device_write(struct file *filp, const char __user *buff, size_t len, loff_t * off)
{
EPRINTF("Operation <<write>> not supported!");
return -1;
{
unsigned long spinlock_flags = 0L;
int result = -1;
+ void __user * arg_pointer = (void __user *) arg;
// DPRINTF("Command=%d", cmd);
switch (cmd)
{
ioctl_general_t param;
unsigned long nIgnoredBytes = 0;
memset(¶m, '0', sizeof(ioctl_general_t));
- nIgnoredBytes = copy_from_user (¶m, (void*)arg, sizeof(ioctl_general_t));
+ nIgnoredBytes = copy_from_user (¶m, arg_pointer, sizeof(ioctl_general_t));
if (nIgnoredBytes > 0) {
result = -1;
break;
unsigned long nIgnoredBytes = 0;
memset(¶m, '0', sizeof(ioctl_general_t));
param.m_unsignedLong = GetECMode();
- nIgnoredBytes = copy_to_user ((void*)arg, ¶m, sizeof (ioctl_general_t));
+ nIgnoredBytes = copy_to_user (arg_pointer, ¶m, sizeof (ioctl_general_t));
if (nIgnoredBytes > 0) {
result = -1;
break;
ioctl_general_t param;
unsigned long nIgnoredBytes = 0;
memset(¶m, '0', sizeof(ioctl_general_t));
- nIgnoredBytes = copy_from_user (¶m, (void*)arg, sizeof(ioctl_general_t));
+ nIgnoredBytes = copy_from_user (¶m, arg_pointer, sizeof(ioctl_general_t));
if (nIgnoredBytes > 0) {
result = -1;
break;
unsigned long nIgnoredBytes = 0;
memset(¶m, '0', sizeof(ioctl_general_t));
param.m_unsignedLong = GetBufferSize();
- nIgnoredBytes = copy_to_user ((void*)arg, ¶m, sizeof (ioctl_general_t));
+ nIgnoredBytes = copy_to_user (arg_pointer, ¶m, sizeof (ioctl_general_t));
if (nIgnoredBytes > 0) {
result = -1;
break;
static ec_info_t ec_info_copy;
int nIgnoredBytes = 0;
- nIgnoredBytes = copy_from_user (&ec_info_copy, (ec_info_t *) arg, sizeof (ec_info_t));
+ nIgnoredBytes = copy_from_user (&ec_info_copy, (const void __user *) arg, sizeof (ec_info_t));
if(nIgnoredBytes > 0)
{
EPRINTF ("copy_from_user(%08X,%08X)=%d", (unsigned) arg, (unsigned) &ec_info_copy, nIgnoredBytes);
case EC_IOCTL_SET_APPDEPS:
{
size_t size;
- result = copy_from_user(&size, (void *)arg, sizeof(size_t));
+ result = copy_from_user(&size, arg_pointer, sizeof(size_t));
if (result) {
EPRINTF("Cannot copy deps size!");
result = -1;
}
DPRINTF("Mem for deps has been allocated");
- result = copy_from_user(deps, (void *)arg, size);
+ result = copy_from_user(deps, arg_pointer, size);
if (result) {
EPRINTF("Cannot copy deps!");
result = -1;
{
unsigned int _pid;
- result = copy_from_user(&_pid, (void *)arg, sizeof(unsigned int));
+ result = copy_from_user(&_pid, arg_pointer, sizeof(unsigned int));
if (result) {
EPRINTF("Cannot copy pid!");
result = -1;
{
size_t size;
- result = copy_from_user(&size, (void *)arg, sizeof(size_t));
+ result = copy_from_user(&size, arg_pointer, sizeof(size_t));
if (result) {
EPRINTF("Cannot copy bundle size!");
result = -1;
}
DPRINTF("Mem for bundle has been alloced");
- result = copy_from_user(bundle, (void *)arg, size);
+ result = copy_from_user(bundle, arg_pointer, size);
if (result) {
EPRINTF("Cannot copy bundle!");
result = -1;
unsigned char *p_data;
int err;
result = 0;
- err = copy_from_user(&args_cnt, (void *)arg, sizeof(int));
+ err = copy_from_user(&args_cnt, arg_pointer, sizeof(int));
if (err) {
result = -1;
break;
result = -1;
break;
}
- err = copy_from_user(&p_cond->tmpl, p_data, sizeof(struct event_tmpl));
+ err = copy_from_user(&p_cond->tmpl, (const void __user *)p_data,
+ sizeof(struct event_tmpl));
if (err) {
DPRINTF("Cannot copy cond from user!");
result = -1;
spin_unlock_irqrestore(&local_mh->lock, dbi_flags);
break;
}
- case EC_IOCTL_WAIT_NOTIFICATION:
- {
- static ec_info_t ec_info_copy;
-
- ioctl_wait_notification_t ioctl_args;
-
- result = copy_from_user (&ioctl_args, (void *) arg, sizeof (ioctl_args));
- if (result)
- {
- result = -1;
- break;
- }
-
- result = wait_event_interruptible (notification_waiters_queue, ioctl_args.notification_count != notification_count);
- if (result)
- {
- result = -EINTR; // woken by signal (ERESTARTSYS 512)
- break;
- }
-
- ioctl_args.notification_count = notification_count;
-
- result = copy_to_user ((void *) arg, &ioctl_args, sizeof (ioctl_args));
- if (result)
- {
- result = -1;
- break;
- }
-
- // FIXME: synchronization is necessary here (ec_info must be locked).
- // ENTER_CRITICAL_SECTION
- memcpy (&ec_info_copy, &ec_info, sizeof (ec_info_copy));
- // LEAVE_CRITICAL_SECTION
-
- result = copy_to_user ((void *) ioctl_args.p_ec_info, &ec_info_copy, sizeof (ec_info_t));
- if (result)
- {
- EPRINTF ("copy_to_user(%08X,%08X)=%d", (unsigned) ioctl_args.p_ec_info, (unsigned) &ec_info_copy, result);
- result = -1;
- break;
- }
- DPRINTF("Wake up");
- break;
- }
case EC_IOCTL_US_EVENT:
{
ioctl_us_event_t ioctl_args;
- result = copy_from_user (&ioctl_args, (void *) arg, sizeof (ioctl_args));
+ result = copy_from_user (&ioctl_args, (const void __user *) arg, sizeof (ioctl_args));
if (result)
{
result = -1;
EPRINTF ("failed to alloc mem for event!");
}
else {
- result = copy_from_user (buf, (void *) ioctl_args.data, ioctl_args.len);
+ result = copy_from_user (buf, (const void __user *) ioctl_args.data, ioctl_args.len);
if (result){
result = -1;
EPRINTF ("failed to copy event from user space!");
case EC_IOCTL_SET_EVENT_MASK:
{
int mask;
- result = copy_from_user (&mask, (void *) arg, sizeof (mask));
+ result = copy_from_user (&mask, arg_pointer, sizeof (mask));
if (result)
{
result = -EFAULT;
{
result = -EFAULT;
}
- result = copy_to_user ((void *) arg, &mask, sizeof (mask));
+ result = copy_to_user (arg_pointer, &mask, sizeof (mask));
if (result)
{
result = -EFAULT;
case EC_IOCTL_SET_PREDEF_UPROBES:
{
+ ioctl_predef_uprobes_info_t data;
+
result = -1;
break;
- ioctl_predef_uprobes_info_t data;
- result = copy_from_user (&data, (void *) arg, sizeof (data));
+ result = copy_from_user (&data, arg_pointer, sizeof (data));
if (result)
{
result = -EFAULT;
{
result = -EFAULT;
}
- result = copy_to_user ((void *) arg, &size, sizeof (size));
+ result = copy_to_user (arg_pointer, &size, sizeof (size));
if (result)
{
result = -EFAULT;