kernel_optimize_test/drivers/block/zram
Dan Carpenter 7091fcc75f zram: off by one in read_block_state()
[ Upstream commit a88e03cf3d190cf46bc4063a9b7efe87590de5f4 ]

snprintf() returns the number of bytes it would have printed if there
were space.  But it does not count the NUL terminator.  So that means
that if "count == copied" then this has already overflowed by one
character.

This bug likely isn't super harmful in real life.

Link: https://lkml.kernel.org/r/20210916130404.GA25094@kili
Fixes: c0265342bf ("zram: introduce zram memory tracking")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 14:04:27 +01:00
..
Kconfig docs: blockdev: add it to the admin-guide 2019-07-15 11:03:01 -03:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
zcomp.c zcomp: Use ARRAY_SIZE() for backends list 2020-06-04 19:06:24 -07:00
zcomp.h zram: Use local lock to protect per-CPU data 2020-05-28 10:31:10 +02:00
zram_drv.c zram: off by one in read_block_state() 2021-11-18 14:04:27 +01:00
zram_drv.h zram: idle writeback fixes and cleanup 2019-01-08 17:15:10 -08:00