title: ioct multiple arguments passing
body: <p>I try to pass two arguments from user space program to change a buffer size and number of buffer on char device. I tried multiple cast I get always cast errors</p>
  
  <pre><code> error: cannot convert to a pointer type copy_from_user((char *)msg, arg, sizeof(msg));
  </code></pre>
  
  <p>or </p>
  
  <pre><code>cannot convert to a pointer typecopy_from_user((char *)msg, (char *)arg, sizeof(msg));
  </code></pre>
  
  <p>header.h</p>
  
  <pre><code>struct ioctl_arguments {
           int block_number;
           int block_size;
   };
  </code></pre>
  
  <p>the kernel module and the c program include both the header.h</p>
  
  <p>c program</p>
  
  <pre><code>#define DEVICE_PATH "/dev/driver"
  #define MAGIC_NO 'k'
  struct ioctl_arguments args;
  #define IOCTL_CMD _IOWR(MAGIC_NO, 0, args)
  int main()
  {
      int fd;
      args.block_number = 10;
      args.block_size = 10;
      fd = open(DEVICE_PATH, O_RDWR);
      ioctl(fd, IOCTL_CMD,&amp;args);
      close(fd);
      return 0;
  }
  </code></pre>
  
  <p>device driver </p>
  
  <pre><code>static int BlockNumber = 20;
  static int BlockSize = 5;
  struct ioctl_arguments msg;
  
  static int sample_ioctl (struct file *filp, unsigned int cmd, unsigned long arg);
  
  static int sample_ioctl (struct file *filp, unsigned int cmd, unsigned long arg) 
  {
  
    // copy two parameters from outside, we use struct
    copy_from_user((char *)msg, (char *)arg, sizeof(msg));
  </code></pre>