Message ID | 20200821004211.g7aXs16ZQ%akpm@linux-foundation.org |
---|---|
State | New |
Headers | show |
Series | + mm-track-page-table-modifications-in-__apply_to_page_range.patch added to -mm tree | expand |
--- a/fs/romfs/storage.c~romfs-fix-uninitialized-memory-leak-in-romfs_dev_read +++ a/fs/romfs/storage.c @@ -217,10 +217,8 @@ int romfs_dev_read(struct super_block *s size_t limit; limit = romfs_maxsize(sb); - if (pos >= limit) + if (pos >= limit || buflen > limit - pos) return -EIO; - if (buflen > limit - pos) - buflen = limit - pos; #ifdef CONFIG_ROMFS_ON_MTD if (sb->s_mtd)