dm bufio: initialize read-only module parameters
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 5 Dec 2013 22:33:29 +0000 (17:33 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 3 Jan 2014 04:33:30 +0000 (04:33 +0000)
commit2941fcfe04bb2473fdbe07eac48da7ccb74c89ae
tree3f4837fcd667ca6ac25aa944148c21cf3355ee73
parentd7b05fbb31ac1c454c5bbf303da75b3e1810de51
dm bufio: initialize read-only module parameters

commit 4cb57ab4a2e61978f3a9b7d4f53988f30d61c27f upstream.

Some module parameters in dm-bufio are read-only. These parameters
inform the user about memory consumption. They are not supposed to be
changed by the user.

However, despite being read-only, these parameters can be set on
modprobe or insmod command line, for example:
modprobe dm-bufio current_allocated_bytes=12345

The kernel doesn't expect that these variables can be non-zero at module
initialization and if the user sets them, it results in BUG.

This patch initializes the variables in the module init routine, so that
user-supplied values are ignored.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/md/dm-bufio.c