title: kstrtoint in sysfs for c kernel module
body: <p>Hi I am trying to use a kobject to write to a int array from sysfs. So the input is a char* and a size variable. I cant seem to get this to work however. My expected input is <code>"num1 num2 num3 "</code></p>
  
  <pre><code>static ssize_t pids_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {
  
  int num_count = 0;
  int i = 0;
  int result = 0;
  int cur_pid = 0;
  char *dst;
  char *ddst;
  
  printk(KERN_INFO "GPIO_DEGUG: enter");
  
  dst = buf;
  ddst = buf;
  
  printk(KERN_INFO "GPIO_DEGUG:  size of buffer %d ",count);
  
  
  while(ddst &lt; (buf + sizeof(size_t)*count)) {
  ddst ++;
  if (ddst[0] == ' ') {
     result = kstrtoint(dst,10,&amp;cur_pid);
     dst=ddst+1;
  
     printk(KERN_INFO "GPIO_DEGUG: kstrtoint suceeded %d ",cur_pid);
     printk(KERN_INFO "GPIO_DEGUG: kstrtoint suceeded res: %d ",result);
     pids[num_count] = cur_pid;
     num_count += 1;
     }
  }
  
  for(i=0;i&lt;num_count;i++) {
      printk(KERN_INFO "GPIO_TEST: pid: %d \n", pids[i]);
  }
  printk(KERN_INFO "GPIO_DEBUG: leaving\n");
  return count;                                         
  }
  </code></pre>
  
  <p>When I <code>echo "100 " &gt; /sys/vt/vt7/pids</code> I get</p>
  
  <pre><code>[ 2765.712770] GPIO_DEGUG: enter 
  [ 2765.724468] GPIO_DEGUG:  size of buffer 5 
  [ 2765.735101] GPIO_DEGUG: kstrtoint suceeded 0 
  [ 2765.746526] GPIO_DEGUG: kstrtoint suceeded res: -22 
  [ 2765.757746] GPIO_DEBUG: leaving 
  </code></pre>
  
  <p>I suppose this is an argument error any help would be nice, thanks.</p>