# Re: \[PATCH 1/3\] lib: early\_string: allow early usage of some string functions

- From: Daniel Walker \<hidden\>
- Date: 2021-05-03 18:01:46 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2021/05/6356798
- Thread: https://ratatoskr.run/linuxppc-dev/2021/04/6354402/t.md

```text
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
```
