aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2014-01-20 10:43:33 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-01-22 08:02:15 -0500
commit7e2e2b96f50d17f301f1ee5505bf949c1d90204e (patch)
treeda300e53a2c5f4de9bd124238dffbfc5b048bc3b
parent4dd841a0c4fe4d5be3825cf0e129d3da431d82b0 (diff)
s390/xpram: don't modify module parameters
During parsing of the sizes array the pointer to the particular string is lost. Keep it by using an extra pointer to store the end position of the parsed string. Keeping these parameters accessible can be helpful for debugging purposes and for userspace reading the parameters at runtime via sysfs. Also this will ensure that the memory is freed at module unload time. Reported-by: Michael Veigel <veigel@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/block/xpram.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 464dd29d06c0..58141f0651f2 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -257,6 +257,7 @@ static int __init xpram_setup_sizes(unsigned long pages)
257 unsigned long mem_needed; 257 unsigned long mem_needed;
258 unsigned long mem_auto; 258 unsigned long mem_auto;
259 unsigned long long size; 259 unsigned long long size;
260 char *sizes_end;
260 int mem_auto_no; 261 int mem_auto_no;
261 int i; 262 int i;
262 263
@@ -275,8 +276,8 @@ static int __init xpram_setup_sizes(unsigned long pages)
275 mem_auto_no = 0; 276 mem_auto_no = 0;
276 for (i = 0; i < xpram_devs; i++) { 277 for (i = 0; i < xpram_devs; i++) {
277 if (sizes[i]) { 278 if (sizes[i]) {
278 size = simple_strtoull(sizes[i], &sizes[i], 0); 279 size = simple_strtoull(sizes[i], &sizes_end, 0);
279 switch (sizes[i][0]) { 280 switch (*sizes_end) {
280 case 'g': 281 case 'g':
281 case 'G': 282 case 'G':
282 size <<= 20; 283 size <<= 20;