]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/base/regmap/regmap-debugfs.c
regmap: debugfs: Ensure we don't underflow when printing access masks
[mirror_ubuntu-zesty-kernel.git] / drivers / base / regmap / regmap-debugfs.c
index f42f2bac646623fc1db767bae3a5fff0ecf98aac..1f327898e53d12ffaf8c09a0bc3b9f573f973b1e 100644 (file)
@@ -432,7 +432,7 @@ static ssize_t regmap_access_read_file(struct file *file,
                /* If we're in the region the user is trying to read */
                if (p >= *ppos) {
                        /* ...but not beyond it */
-                       if (buf_pos >= count - 1 - tot_len)
+                       if (buf_pos + tot_len + 1 >= count)
                                break;
 
                        /* Format the register */