Skip to content

Commit

Permalink
dm stats: initialize read-only module parameter
Browse files Browse the repository at this point in the history
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+
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Dec 11, 2013
1 parent 4cb57ab commit 76f5bee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/md/dm-stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ int dm_stats_message(struct mapped_device *md, unsigned argc, char **argv,

int __init dm_statistics_init(void)
{
shared_memory_amount = 0;
dm_stat_need_rcu_barrier = 0;
return 0;
}
Expand Down

0 comments on commit 76f5bee

Please sign in to comment.