aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2012-07-20 05:15:01 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-07-20 05:15:01 -0400
commit2b7547578b9fdf811072cfc0c3594eb370e7d219 (patch)
tree5c14ba9e87c19db2d644a91aec127307afe7385b /arch/s390/kernel
parent50bb1f761e420776a4d10798babfc76793d4056c (diff)
s390/lgr: Add init check to lgr_info_log()
If lgr has not been initialized, the lgr_info_log() function currently crashes because 'lgr_page' is not allocated. To fix this 'lgr_page' is allocated statically now. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/lgr.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index 87f080b17af1..eca94e74d19a 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -45,7 +45,7 @@ struct lgr_info {
45/* 45/*
46 * LGR globals 46 * LGR globals
47 */ 47 */
48static void *lgr_page; 48static char lgr_page[PAGE_SIZE] __aligned(PAGE_SIZE);
49static struct lgr_info lgr_info_last; 49static struct lgr_info lgr_info_last;
50static struct lgr_info lgr_info_cur; 50static struct lgr_info lgr_info_cur;
51static struct debug_info *lgr_dbf; 51static struct debug_info *lgr_dbf;
@@ -74,7 +74,7 @@ static void cpascii(char *dst, char *src, int size)
74 */ 74 */
75static void lgr_stsi_1_1_1(struct lgr_info *lgr_info) 75static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
76{ 76{
77 struct sysinfo_1_1_1 *si = lgr_page; 77 struct sysinfo_1_1_1 *si = (void *) lgr_page;
78 78
79 if (stsi(si, 1, 1, 1) == -ENOSYS) 79 if (stsi(si, 1, 1, 1) == -ENOSYS)
80 return; 80 return;
@@ -91,7 +91,7 @@ static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
91 */ 91 */
92static void lgr_stsi_2_2_2(struct lgr_info *lgr_info) 92static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
93{ 93{
94 struct sysinfo_2_2_2 *si = lgr_page; 94 struct sysinfo_2_2_2 *si = (void *) lgr_page;
95 95
96 if (stsi(si, 2, 2, 2) == -ENOSYS) 96 if (stsi(si, 2, 2, 2) == -ENOSYS)
97 return; 97 return;
@@ -105,7 +105,7 @@ static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
105 */ 105 */
106static void lgr_stsi_3_2_2(struct lgr_info *lgr_info) 106static void lgr_stsi_3_2_2(struct lgr_info *lgr_info)
107{ 107{
108 struct sysinfo_3_2_2 *si = lgr_page; 108 struct sysinfo_3_2_2 *si = (void *) lgr_page;
109 int i; 109 int i;
110 110
111 if (stsi(si, 3, 2, 2) == -ENOSYS) 111 if (stsi(si, 3, 2, 2) == -ENOSYS)
@@ -183,14 +183,9 @@ static void lgr_timer_set(void)
183 */ 183 */
184static int __init lgr_init(void) 184static int __init lgr_init(void)
185{ 185{
186 lgr_page = (void *) __get_free_pages(GFP_KERNEL, 0);
187 if (!lgr_page)
188 return -ENOMEM;
189 lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info)); 186 lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info));
190 if (!lgr_dbf) { 187 if (!lgr_dbf)
191 free_page((unsigned long) lgr_page);
192 return -ENOMEM; 188 return -ENOMEM;
193 }
194 debug_register_view(lgr_dbf, &debug_hex_ascii_view); 189 debug_register_view(lgr_dbf, &debug_hex_ascii_view);
195 lgr_info_get(&lgr_info_last); 190 lgr_info_get(&lgr_info_last);
196 debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); 191 debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last));