linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next][V4] tpm: remove kmalloc failure error message
@ 2025-04-30  8:34 Colin Ian King
  2025-04-30 12:18 ` Jason Gunthorpe
  2025-04-30 15:24 ` Jarkko Sakkinen
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2025-04-30  8:34 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, linux-integrity
  Cc: kernel-janitors, linux-kernel

The kmalloc failure message is just noise. Remove it and
replace -EFAULT with -ENOMEM as standard for out of memory
allocation error returns.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
V1: remove trailing space after \n
V2: remove entire message, originally just removed a trailing space
V3: replace -EFAULT with -ENOMEM
V4: send correct fix for V3, actually return -ENOMEM
---

 drivers/char/tpm/eventlog/tpm1.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
index 12ee42a31c71..e7913b2853d5 100644
--- a/drivers/char/tpm/eventlog/tpm1.c
+++ b/drivers/char/tpm/eventlog/tpm1.c
@@ -257,11 +257,8 @@ static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
 	    (unsigned char *)(v + sizeof(struct tcpa_event));
 
 	eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
-	if (!eventname) {
-		printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
-		       __func__);
-		return -EFAULT;
-	}
+	if (!eventname)
+		return -ENOMEM;
 
 	/* 1st: PCR */
 	seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next][V4] tpm: remove kmalloc failure error message
  2025-04-30  8:34 [PATCH][next][V4] tpm: remove kmalloc failure error message Colin Ian King
@ 2025-04-30 12:18 ` Jason Gunthorpe
  2025-04-30 15:24 ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2025-04-30 12:18 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Peter Huewe, Jarkko Sakkinen, linux-integrity, kernel-janitors,
	linux-kernel

On Wed, Apr 30, 2025 at 09:34:35AM +0100, Colin Ian King wrote:
> The kmalloc failure message is just noise. Remove it and
> replace -EFAULT with -ENOMEM as standard for out of memory
> allocation error returns.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> V1: remove trailing space after \n
> V2: remove entire message, originally just removed a trailing space
> V3: replace -EFAULT with -ENOMEM
> V4: send correct fix for V3, actually return -ENOMEM
> ---
> 
>  drivers/char/tpm/eventlog/tpm1.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next][V4] tpm: remove kmalloc failure error message
  2025-04-30  8:34 [PATCH][next][V4] tpm: remove kmalloc failure error message Colin Ian King
  2025-04-30 12:18 ` Jason Gunthorpe
@ 2025-04-30 15:24 ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2025-04-30 15:24 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, kernel-janitors,
	linux-kernel

On Wed, Apr 30, 2025 at 09:34:35AM +0100, Colin Ian King wrote:
> The kmalloc failure message is just noise. Remove it and
> replace -EFAULT with -ENOMEM as standard for out of memory
> allocation error returns.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> V1: remove trailing space after \n
> V2: remove entire message, originally just removed a trailing space
> V3: replace -EFAULT with -ENOMEM
> V4: send correct fix for V3, actually return -ENOMEM
> ---
> 
>  drivers/char/tpm/eventlog/tpm1.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
> index 12ee42a31c71..e7913b2853d5 100644
> --- a/drivers/char/tpm/eventlog/tpm1.c
> +++ b/drivers/char/tpm/eventlog/tpm1.c
> @@ -257,11 +257,8 @@ static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
>  	    (unsigned char *)(v + sizeof(struct tcpa_event));
>  
>  	eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
> -	if (!eventname) {
> -		printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
> -		       __func__);
> -		return -EFAULT;
> -	}
> +	if (!eventname)
> +		return -ENOMEM;
>  
>  	/* 1st: PCR */
>  	seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));
> -- 
> 2.49.0
> 

Ya, I think this make sense.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-30 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30  8:34 [PATCH][next][V4] tpm: remove kmalloc failure error message Colin Ian King
2025-04-30 12:18 ` Jason Gunthorpe
2025-04-30 15:24 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).