Linux Integrity Measurement development
 help / color / mirror / Atom feed
* [PATCH] tpm: remove kmalloc failure error message
@ 2025-04-30  8:00 Colin Ian King
  2025-04-30  8:12 ` Colin King (gmail)
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-04-30  8:00 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

---
 drivers/char/tpm/eventlog/tpm1.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
index 12ee42a31c71..773e9e537991 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__);
+	if (!eventname)
 		return -EFAULT;
-	}
 
 	/* 1st: PCR */
 	seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));
-- 
2.49.0


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

* Re: [PATCH] tpm: remove kmalloc failure error message
  2025-04-30  8:00 [PATCH] tpm: remove kmalloc failure error message Colin Ian King
@ 2025-04-30  8:12 ` Colin King (gmail)
  0 siblings, 0 replies; 2+ messages in thread
From: Colin King (gmail) @ 2025-04-30  8:12 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, linux-integrity
  Cc: kernel-janitors, linux-kernel


[-- Attachment #1.1.1: Type: text/plain, Size: 1254 bytes --]

NAK, sent the wrong patch! Doh.

On 30/04/2025 09:00, 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
> 
> ---
>   drivers/char/tpm/eventlog/tpm1.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
> index 12ee42a31c71..773e9e537991 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__);
> +	if (!eventname)
>   		return -EFAULT;
> -	}
>   
>   	/* 1st: PCR */
>   	seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30  8:00 [PATCH] tpm: remove kmalloc failure error message Colin Ian King
2025-04-30  8:12 ` Colin King (gmail)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox