Hello Bartosz Golaszewski, The patch 2a9e27408e12: "gpio: mockup: rework debugfs interface" from Jan 17, 2019, leads to the following static checker warning: drivers/gpio/gpio-mockup.c:223 gpio_mockup_debugfs_read() warn: maybe return -EFAULT instead of the bytes remaining? drivers/gpio/gpio-mockup.c 199 static ssize_t gpio_mockup_debugfs_read(struct file *file, 200 char __user *usr_buf, 201 size_t size, loff_t *ppos) 202 { 203 struct gpio_mockup_dbgfs_private *priv; 204 struct gpio_mockup_chip *chip; 205 struct seq_file *sfile; 206 struct gpio_chip *gc; 207 char buf[3]; 208 int val, rv; 209 210 if (*ppos != 0) 211 return 0; 212 213 sfile = file->private_data; 214 priv = sfile->private; 215 chip = priv->chip; 216 gc = &chip->gc; 217 218 val = gpio_mockup_get(gc, priv->offset); 219 snprintf(buf, sizeof(buf), "%d\n", val); 220 221 rv = copy_to_user(usr_buf, buf, sizeof(buf)); 222 if (rv) --> 223 return rv; 224 225 return sizeof(buf) - 1; The copy_to_user() function returns the number of bytes remaining to be copied. We probably want to return -EFAULT: if (copy_to_user(usr_buf, buf, sizeof(buf))) return -EFAULT; But I would also question the sizeof(buf). We should consider that maybe the user only wants 1 byte and not write beyond the end of their buffer. count = min(count, sizeof(buf)); if (copy_to_user(usr_buf, buf, count)) return -EFAULT; Finally, on the success path, we should probably count the NUL terminator? (I forget the rules). 226 } regards, dan carpenter