Re: [PATCH 1/5] usage.c: add a non-fatal bug() function to go with BUG()

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

 



On 2022.05.21 19:14, Ævar Arnfjörð Bjarmason wrote:
> Add a bug() function to use in cases where we'd like to indicate a
> runtime BUG(), but would like to deref the BUG() call because we're

Typo: I assume you meant s/deref/defer/


[snip]

> diff --git a/trace2.c b/trace2.c
> index e01cf77f1a8..d49d5d5a082 100644
> --- a/trace2.c
> +++ b/trace2.c
> @@ -211,6 +211,12 @@ int trace2_cmd_exit_fl(const char *file, int line, int code)
>  
>  	code &= 0xff;
>  
> +	if (bug_called_must_BUG) {
> +		/* BUG_vfl() calls exit(), which calls us again */
> +		bug_called_must_BUG = 0;
> +		BUG("had bug() output above, in addition missed BUG_if_bug() call");
> +	}
> +
>  	if (!trace2_enabled)
>  		return code;

While it does seem that trace2_cmd_exit_fl() is the only reasonable
place to put this cleanup code, perhaps it makes sense to rename this
function and move it out of trace2.c, to more clearly show that it has
multiple responsibilities now?



[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