When an error is detected, use pr_err() instead of pr_debug() to output
log message.
In addition, remove the unnecessary return from set_page_address().
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
arch/x86/kernel/kexec-bzimage64.c | 2 +-
mm/highmem.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index a61c12c01270..472a45dbc79a 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -424,7 +424,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
* command line. Make sure it does not overflow
*/
if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) {
- pr_debug("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
+ pr_err("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
return ERR_PTR(-EINVAL);
}
diff --git a/mm/highmem.c b/mm/highmem.c
index e19269093a93..bd48ba445dd4 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -799,8 +799,6 @@ void set_page_address(struct page *page, void *virtual)
}
spin_unlock_irqrestore(&pas->lock, flags);
}
-
- return;
}
void __init page_address_init(void)
--
2.43.0
On Sun, 17 Dec 2023 11:35:28 +0800 Yuntao Wang <ytcoode@gmail.com> wrote:
> When an error is detected, use pr_err() instead of pr_debug() to output
> log message.
>
> In addition, remove the unnecessary return from set_page_address().
>
> ...
>
> --- a/arch/x86/kernel/kexec-bzimage64.c
> +++ b/arch/x86/kernel/kexec-bzimage64.c
> @@ -424,7 +424,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
> * command line. Make sure it does not overflow
> */
> if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) {
> - pr_debug("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
> + pr_err("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
> return ERR_PTR(-EINVAL);
> }
https://lkml.kernel.org/r/20231213055747.61826-4-bhe@redhat.com has
already changed this to call kexec_dprintk(). I'll skip this patch.
When an error is detected, use pr_err() instead of kexec_dprintk() to
output log message.
In addition, remove the unnecessary return from set_page_address().
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
arch/x86/kernel/kexec-bzimage64.c | 2 +-
mm/highmem.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index e9ae0eac6bf9..4a77d5dd4bce 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -429,7 +429,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
* command line. Make sure it does not overflow
*/
if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) {
- kexec_dprintk("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
+ pr_err("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
return ERR_PTR(-EINVAL);
}
diff --git a/mm/highmem.c b/mm/highmem.c
index e19269093a93..bd48ba445dd4 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -799,8 +799,6 @@ void set_page_address(struct page *page, void *virtual)
}
spin_unlock_irqrestore(&pas->lock, flags);
}
-
- return;
}
void __init page_address_init(void)
--
2.43.0
On Tue, 19 Dec 2023 15:29:01 +0800 Yuntao Wang <ytcoode@gmail.com> wrote:
> When an error is detected, use pr_err() instead of kexec_dprintk() to
> output log message.
>
> In addition, remove the unnecessary return from set_page_address().
The above describes what the code does, which is already quite clear
from looking at the code.
Please write changelogs and code comments which describe *why* the code
does something, rather than *what* it does.
>
>
> --- a/arch/x86/kernel/kexec-bzimage64.c
> +++ b/arch/x86/kernel/kexec-bzimage64.c
> @@ -429,7 +429,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
> * command line. Make sure it does not overflow
> */
> if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) {
> - kexec_dprintk("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
> + pr_err("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
ie, what are the reasons for this change?
> return ERR_PTR(-EINVAL);
> }
>
> diff --git a/mm/highmem.c b/mm/highmem.c
> index e19269093a93..bd48ba445dd4 100644
> --- a/mm/highmem.c
> +++ b/mm/highmem.c
> @@ -799,8 +799,6 @@ void set_page_address(struct page *page, void *virtual)
> }
> spin_unlock_irqrestore(&pas->lock, flags);
> }
> -
> - return;
> }
>
> void __init page_address_init(void)
> --
> 2.43.0
When detecting an error, the current code uses kexec_dprintk() to output
log message. This is not quite appropriate as kexec_dprintk() is mainly
used for outputting debugging messages, rather than error messages.
Replace kexec_dprintk() with pr_err(). This also makes the output method
for this error log align with the output method for other error logs in
this function.
Additionally, the last return statement in set_page_address() is
unnecessary, remove it.
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
v1 -> v2: Rewrite changelogs
arch/x86/kernel/kexec-bzimage64.c | 2 +-
mm/highmem.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index e9ae0eac6bf9..4a77d5dd4bce 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -429,7 +429,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
* command line. Make sure it does not overflow
*/
if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) {
- kexec_dprintk("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
+ pr_err("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
return ERR_PTR(-EINVAL);
}
diff --git a/mm/highmem.c b/mm/highmem.c
index e19269093a93..bd48ba445dd4 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -799,8 +799,6 @@ void set_page_address(struct page *page, void *virtual)
}
spin_unlock_irqrestore(&pas->lock, flags);
}
-
- return;
}
void __init page_address_init(void)
--
2.43.0
© 2016 - 2025 Red Hat, Inc.