linux/fs/pstore
Dan Carpenter 2c09d1443b pstore/zone: cleanup "rcnt" type
The info->read() function returns ssize_t.  That means that info->read()
either returns either negative error codes or a positive number
representing the bytes read.

The "rcnt" variable should be declared as ssize_t as well.  Most places
do this correctly but psz_kmsg_recover_meta() needed to be fixed.

This code casts the "rcnt" to int.  That is unnecessary when "rcnt"
is already signed.  It's also slightly wrong because if info->read()
returned a very high (more than INT_MAX) number of bytes then this might
treat that as an error.  This bug cannot happen in real life, so it
doesn't affect run time, but static checkers correctly complain that it
is wrong.

fs/pstore/zone.c:366 psz_kmsg_recover_data() warn: casting 'rcnt' truncates high bits

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/YrRtPSFHDVJzV6d+@kili
2022-06-23 08:27:52 -07:00
..
blk.c pstore/blk: Use "%lu" to format unsigned long 2021-11-21 09:44:19 -08:00
ftrace.c pstore/ftrace: Allow immediate recording 2021-11-18 10:29:52 -08:00
inode.c pstore: Fix warning in pstore_kill_sb() 2021-02-23 09:27:20 -08:00
internal.h pstore: Move kmsg_bytes default into Kconfig 2020-12-01 12:09:17 -08:00
Kconfig Revert "mark pstore-blk as broken" 2021-11-16 17:23:42 -07:00
Makefile pstore/blk: Introduce backend for block devices 2020-05-30 10:34:03 -07:00
platform.c pstore: migrate to crypto acomp interface 2022-05-12 09:31:00 -07:00
pmsg.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
ram_core.c pstore: Add prefix to ECC messages 2022-03-01 10:36:59 -08:00
ram.c pstore: Add mem_type property DT parsing support 2021-03-31 10:06:23 -07:00
zone.c pstore/zone: cleanup "rcnt" type 2022-06-23 08:27:52 -07:00