Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm stats: initialize read-only module parameter

The module parameter stats_current_allocated_bytes in dm-mod is
read-only. This parameter informs the user about memory
consumption. It is not supposed to be changed by the user.

However, despite being read-only, this parameter can be set on
modprobe or insmod command line:
modprobe dm-mod stats_current_allocated_bytes=12345

The kernel doesn't expect that this variable can be non-zero at module
initialization and if the user sets it, it results in warning.

This patch initializes the variable in the module init routine, so
that user-supplied value is ignored.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 3.12+

authored by

Mikulas Patocka and committed by
Mike Snitzer
76f5bee5 4cb57ab4

+1
+1
drivers/md/dm-stats.c
··· 964 964 965 965 int __init dm_statistics_init(void) 966 966 { 967 + shared_memory_amount = 0; 967 968 dm_stat_need_rcu_barrier = 0; 968 969 return 0; 969 970 }