All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Walker <danielwa@cisco.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org, x86@kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	xe-linux-external@cisco.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] lib: early_string: allow early usage of some string functions
Date: Mon, 3 May 2021 11:01:41 -0700	[thread overview]
Message-ID: <20210503180141.GO3844417@zorba> (raw)
In-Reply-To: <e355ecc9-574a-dbcb-7864-5aa4974e1971@csgroup.eu>

On Sat, May 01, 2021 at 09:31:47AM +0200, Christophe Leroy wrote:
> 
> > In fact, should be like in prom_init today:
> > 
> > #ifdef __EARLY_STRING_ENABLED
> >      if (dsize >= count)
> >          return count;
> > #else
> >      BUG_ON(dsize >= count);
> > #endif
> 
> Thinking about it once more, this BUG_ON() is overkill and should be
> avoided, see https://www.kernel.org/doc/html/latest/process/deprecated.html
> 
> Therefore, something like the following would make it:
> 
> 	if (dsize >= count) {
> 		WARN_ON(!__is_defined(__EARLY_STRING_ENABLED));
> 
> 		return count;
> 	}

I agree, it's overkill it stop the system for this condition.

how about I do something more like this for my changes,


> 	if (WARN_ON(dsize >= count && !__is_defined(__EARLY_STRING_ENABLED)))
> 		return count;

and for generic kernel,

> 	if (WARN_ON(dsize >= count))
> 		return count;



Daniel

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Walker <danielwa@cisco.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	x86@kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, xe-linux-external@cisco.com
Subject: Re: [PATCH 1/3] lib: early_string: allow early usage of some string functions
Date: Mon, 3 May 2021 11:01:41 -0700	[thread overview]
Message-ID: <20210503180141.GO3844417@zorba> (raw)
In-Reply-To: <e355ecc9-574a-dbcb-7864-5aa4974e1971@csgroup.eu>

On Sat, May 01, 2021 at 09:31:47AM +0200, Christophe Leroy wrote:
> 
> > In fact, should be like in prom_init today:
> > 
> > #ifdef __EARLY_STRING_ENABLED
> >      if (dsize >= count)
> >          return count;
> > #else
> >      BUG_ON(dsize >= count);
> > #endif
> 
> Thinking about it once more, this BUG_ON() is overkill and should be
> avoided, see https://www.kernel.org/doc/html/latest/process/deprecated.html
> 
> Therefore, something like the following would make it:
> 
> 	if (dsize >= count) {
> 		WARN_ON(!__is_defined(__EARLY_STRING_ENABLED));
> 
> 		return count;
> 	}

I agree, it's overkill it stop the system for this condition.

how about I do something more like this for my changes,


> 	if (WARN_ON(dsize >= count && !__is_defined(__EARLY_STRING_ENABLED)))
> 		return count;

and for generic kernel,

> 	if (WARN_ON(dsize >= count))
> 		return count;



Daniel

  reply	other threads:[~2021-05-03 18:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30  4:22 [PATCH 1/3] lib: early_string: allow early usage of some string functions Daniel Walker
2021-04-30  4:22 ` Daniel Walker
2021-04-30  4:22 ` [PATCH 2/3] powerpc: prom_init: switch to early " Daniel Walker
2021-04-30  4:22   ` Daniel Walker
2021-04-30  8:51   ` Christophe Leroy
2021-04-30  8:51     ` Christophe Leroy
2021-04-30  4:22 ` [PATCH 3/3] x86: switch amd mem encrypt " Daniel Walker
2021-04-30  4:22   ` Daniel Walker
2021-04-30  8:47 ` [PATCH 1/3] lib: early_string: allow early usage of some " Christophe Leroy
2021-04-30  8:47   ` Christophe Leroy
2021-04-30  8:50   ` Christophe Leroy
2021-04-30  8:50     ` Christophe Leroy
2021-05-01  7:31     ` Christophe Leroy
2021-05-01  7:31       ` Christophe Leroy
2021-05-03 18:01       ` Daniel Walker [this message]
2021-05-03 18:01         ` Daniel Walker
2021-05-03 18:06         ` Daniel Walker
2021-05-03 18:06           ` Daniel Walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210503180141.GO3844417@zorba \
    --to=danielwa@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=x86@kernel.org \
    --cc=xe-linux-external@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.