Re: [PATCH 1/1] vreportf(): avoid buffered write in favor of unbuffered one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 29, 2019 at 03:13:39PM +0100, Johannes Schindelin wrote:

> > I'd recommend xsnprintf() here. If we have a prefix longer than our
> > vreportf() buffer, I think a BUG() is the right outcome.
> 
> But BUG_fl() calls vreportf(). I am worried about an infinite
> recursion...

Good point. I think it would be OK in practice (BUG() gives its own
length-limited prefix), but it's probably a good idea to err on the side
of caution inside vreportf.

> > I'd disagree here. Any caller sending an arbitrarily-large prefix is
> > holding it wrong, and we'd probably want to know as soon as possible
> > (and a BUG() is our best bet there).
> 
> How about truncating already inside the prefix, then? It would miss the
> entire error message... but at least it would print _something_...

Yeah, that might be OK. Hopefully missing the whole rest of the error
message would cause some tests to fail.

You could also abort() after having written if we want to be more
BUG()-like.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux