提交 2b754757 编写于 作者: M Michael Holzheu 提交者: Martin Schwidefsky

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: NMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 50bb1f76
...@@ -45,7 +45,7 @@ struct lgr_info { ...@@ -45,7 +45,7 @@ struct lgr_info {
/* /*
* LGR globals * LGR globals
*/ */
static void *lgr_page; static char lgr_page[PAGE_SIZE] __aligned(PAGE_SIZE);
static struct lgr_info lgr_info_last; static struct lgr_info lgr_info_last;
static struct lgr_info lgr_info_cur; static struct lgr_info lgr_info_cur;
static struct debug_info *lgr_dbf; static struct debug_info *lgr_dbf;
...@@ -74,7 +74,7 @@ static void cpascii(char *dst, char *src, int size) ...@@ -74,7 +74,7 @@ static void cpascii(char *dst, char *src, int size)
*/ */
static void lgr_stsi_1_1_1(struct lgr_info *lgr_info) static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
{ {
struct sysinfo_1_1_1 *si = lgr_page; struct sysinfo_1_1_1 *si = (void *) lgr_page;
if (stsi(si, 1, 1, 1) == -ENOSYS) if (stsi(si, 1, 1, 1) == -ENOSYS)
return; return;
...@@ -91,7 +91,7 @@ static void lgr_stsi_1_1_1(struct lgr_info *lgr_info) ...@@ -91,7 +91,7 @@ static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
*/ */
static void lgr_stsi_2_2_2(struct lgr_info *lgr_info) static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
{ {
struct sysinfo_2_2_2 *si = lgr_page; struct sysinfo_2_2_2 *si = (void *) lgr_page;
if (stsi(si, 2, 2, 2) == -ENOSYS) if (stsi(si, 2, 2, 2) == -ENOSYS)
return; return;
...@@ -105,7 +105,7 @@ static void lgr_stsi_2_2_2(struct lgr_info *lgr_info) ...@@ -105,7 +105,7 @@ static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
*/ */
static void lgr_stsi_3_2_2(struct lgr_info *lgr_info) static void lgr_stsi_3_2_2(struct lgr_info *lgr_info)
{ {
struct sysinfo_3_2_2 *si = lgr_page; struct sysinfo_3_2_2 *si = (void *) lgr_page;
int i; int i;
if (stsi(si, 3, 2, 2) == -ENOSYS) if (stsi(si, 3, 2, 2) == -ENOSYS)
...@@ -183,14 +183,9 @@ static void lgr_timer_set(void) ...@@ -183,14 +183,9 @@ static void lgr_timer_set(void)
*/ */
static int __init lgr_init(void) static int __init lgr_init(void)
{ {
lgr_page = (void *) __get_free_pages(GFP_KERNEL, 0);
if (!lgr_page)
return -ENOMEM;
lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info)); lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info));
if (!lgr_dbf) { if (!lgr_dbf)
free_page((unsigned long) lgr_page);
return -ENOMEM; return -ENOMEM;
}
debug_register_view(lgr_dbf, &debug_hex_ascii_view); debug_register_view(lgr_dbf, &debug_hex_ascii_view);
lgr_info_get(&lgr_info_last); lgr_info_get(&lgr_info_last);
debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册