mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pstore/zone: rewrite some comments for better understanding
@ 2025-01-17  8:42 Eugen Hristev
  2025-05-06  8:23 ` Eugen Hristev
  2025-05-08 16:44 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Eugen Hristev @ 2025-01-17  8:42 UTC (permalink / raw)
  To: kees; +Cc: linux-hardening, linux-kernel, Eugen Hristev

Rewrite some comments to make it more clear and easier to understand.

Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
---
 fs/pstore/zone.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c
index ceb5639a0629..5fa2fa2e7aa7 100644
--- a/fs/pstore/zone.c
+++ b/fs/pstore/zone.c
@@ -214,7 +214,7 @@ static int psz_zone_write(struct pstore_zone *zone,
 		atomic_set(&zone->buffer->datalen, wlen + off);
 	}
 
-	/* avoid to damage old records */
+	/* avoid damaging old records */
 	if (!is_on_panic() && !atomic_read(&pstore_zone_cxt.recovered))
 		goto dirty;
 
@@ -249,7 +249,7 @@ static int psz_zone_write(struct pstore_zone *zone,
 
 	return 0;
 dirty:
-	/* no need to mark dirty if going to try next zone */
+	/* no need to mark it dirty if going to try next zone */
 	if (wcnt == -ENOMSG)
 		return -ENOMSG;
 	atomic_set(&zone->dirty, true);
@@ -378,7 +378,7 @@ static int psz_kmsg_recover_meta(struct psz_context *cxt)
 	struct timespec64 time = { };
 	unsigned long i;
 	/*
-	 * Recover may on panic, we can't allocate any memory by kmalloc.
+	 * Recover may happen on panic, we can't allocate any memory by kmalloc.
 	 * So, we use local array instead.
 	 */
 	char buffer_header[sizeof(*buf) + sizeof(*hdr)] = {0};
@@ -856,11 +856,11 @@ static int notrace psz_record_write(struct pstore_zone *zone,
 
 	/**
 	 * psz_zone_write will set datalen as start + cnt.
-	 * It work if actual data length lesser than buffer size.
-	 * If data length greater than buffer size, pmsg will rewrite to
-	 * beginning of zone, which make buffer->datalen wrongly.
+	 * It works if actual data length is lesser than buffer size.
+	 * If data length is greater than buffer size, pmsg will rewrite to
+	 * the beginning of the zone, which makes buffer->datalen wrong.
 	 * So we should reset datalen as buffer size once actual data length
-	 * greater than buffer size.
+	 * is greater than buffer size.
 	 */
 	if (is_full_data) {
 		atomic_set(&zone->buffer->datalen, zone->buffer_size);
@@ -878,8 +878,9 @@ static int notrace psz_pstore_write(struct pstore_record *record)
 		atomic_set(&cxt->on_panic, 1);
 
 	/*
-	 * if on panic, do not write except panic records
-	 * Fix case that panic_write prints log which wakes up console backend.
+	 * If on panic, do not write anything except panic records.
+	 * Fix the case when panic_write prints log that wakes up
+	 * console backend.
 	 */
 	if (is_on_panic() && record->type != PSTORE_TYPE_DMESG)
 		return -EBUSY;
-- 
2.43.0


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

* Re: [PATCH] pstore/zone: rewrite some comments for better understanding
  2025-01-17  8:42 [PATCH] pstore/zone: rewrite some comments for better understanding Eugen Hristev
@ 2025-05-06  8:23 ` Eugen Hristev
  2025-05-08 16:44 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Eugen Hristev @ 2025-05-06  8:23 UTC (permalink / raw)
  To: kees; +Cc: linux-hardening, linux-kernel



On 1/17/25 10:42, Eugen Hristev wrote:
> Rewrite some comments to make it more clear and easier to understand.
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
> ---

Hello Kees,

Is this patch worth it, or no need to bother ?

Eugen

>  fs/pstore/zone.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c
> index ceb5639a0629..5fa2fa2e7aa7 100644
> --- a/fs/pstore/zone.c
> +++ b/fs/pstore/zone.c
> @@ -214,7 +214,7 @@ static int psz_zone_write(struct pstore_zone *zone,
>  		atomic_set(&zone->buffer->datalen, wlen + off);
>  	}
>  
> -	/* avoid to damage old records */
> +	/* avoid damaging old records */
>  	if (!is_on_panic() && !atomic_read(&pstore_zone_cxt.recovered))
>  		goto dirty;
>  
> @@ -249,7 +249,7 @@ static int psz_zone_write(struct pstore_zone *zone,
>  
>  	return 0;
>  dirty:
> -	/* no need to mark dirty if going to try next zone */
> +	/* no need to mark it dirty if going to try next zone */
>  	if (wcnt == -ENOMSG)
>  		return -ENOMSG;
>  	atomic_set(&zone->dirty, true);
> @@ -378,7 +378,7 @@ static int psz_kmsg_recover_meta(struct psz_context *cxt)
>  	struct timespec64 time = { };
>  	unsigned long i;
>  	/*
> -	 * Recover may on panic, we can't allocate any memory by kmalloc.
> +	 * Recover may happen on panic, we can't allocate any memory by kmalloc.
>  	 * So, we use local array instead.
>  	 */
>  	char buffer_header[sizeof(*buf) + sizeof(*hdr)] = {0};
> @@ -856,11 +856,11 @@ static int notrace psz_record_write(struct pstore_zone *zone,
>  
>  	/**
>  	 * psz_zone_write will set datalen as start + cnt.
> -	 * It work if actual data length lesser than buffer size.
> -	 * If data length greater than buffer size, pmsg will rewrite to
> -	 * beginning of zone, which make buffer->datalen wrongly.
> +	 * It works if actual data length is lesser than buffer size.
> +	 * If data length is greater than buffer size, pmsg will rewrite to
> +	 * the beginning of the zone, which makes buffer->datalen wrong.
>  	 * So we should reset datalen as buffer size once actual data length
> -	 * greater than buffer size.
> +	 * is greater than buffer size.
>  	 */
>  	if (is_full_data) {
>  		atomic_set(&zone->buffer->datalen, zone->buffer_size);
> @@ -878,8 +878,9 @@ static int notrace psz_pstore_write(struct pstore_record *record)
>  		atomic_set(&cxt->on_panic, 1);
>  
>  	/*
> -	 * if on panic, do not write except panic records
> -	 * Fix case that panic_write prints log which wakes up console backend.
> +	 * If on panic, do not write anything except panic records.
> +	 * Fix the case when panic_write prints log that wakes up
> +	 * console backend.
>  	 */
>  	if (is_on_panic() && record->type != PSTORE_TYPE_DMESG)
>  		return -EBUSY;


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

* Re: [PATCH] pstore/zone: rewrite some comments for better understanding
  2025-01-17  8:42 [PATCH] pstore/zone: rewrite some comments for better understanding Eugen Hristev
  2025-05-06  8:23 ` Eugen Hristev
@ 2025-05-08 16:44 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2025-05-08 16:44 UTC (permalink / raw)
  To: Eugen Hristev; +Cc: Kees Cook, linux-hardening, linux-kernel

On Fri, 17 Jan 2025 10:42:28 +0200, Eugen Hristev wrote:
> Rewrite some comments to make it more clear and easier to understand.
> 
> 

Applied to for-next/pstore, thanks!

[1/1] pstore/zone: rewrite some comments for better understanding
      https://git.kernel.org/kees/c/cd5761f6917d

Take care,

-- 
Kees Cook


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

end of thread, other threads:[~2025-05-08 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-17  8:42 [PATCH] pstore/zone: rewrite some comments for better understanding Eugen Hristev
2025-05-06  8:23 ` Eugen Hristev
2025-05-08 16:44 ` Kees Cook

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

all inboxes | Powered by JetHome®