Re: [PATCH 3/5] KernelShark: Fix combo plot plugin crash in case of multiple streams

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

 



On Mon, 27 Jul 2020 10:18:21 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@xxxxxxxxx>
> 
> Added a check if there is a host-guest mapping in the loaded
> multiple streams. If there is no such mapping, print an error and
> exit the KsComboPlotDialog::update() function.
> 
> Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@xxxxxxxxx>
> ---
>  src/plugins/KVMCombo.cpp | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/plugins/KVMCombo.cpp b/src/plugins/KVMCombo.cpp
> index ceb1f47..3ec36b6 100644
> --- a/src/plugins/KVMCombo.cpp
> +++ b/src/plugins/KVMCombo.cpp
> @@ -246,7 +246,12 @@ void KsComboPlotDialog::update()
>  	_guestMap = nullptr;
>  	_guestMapCount = 0;
>  	ret = kshark_tracecmd_get_hostguest_mapping(&_guestMap);
> -	if (ret > 0)
> +	if (ret <= 0) {
> +		QString err("Cannot find host / guest tracing into the loaded streams");
> +		QMessageBox msgBox;
> +		msgBox.critical(nullptr, "Error", err);
> +		return;
> +	} else
>  		_guestMapCount = ret;
>

Just a nit, but if we are following Linux coding styles, the above
should be:

	if (ret <= 0) {
		[..]
	} else {
		_guestMapCount = ret;
	}

As it is looked down upon to have part of an if block have brackets and
another part without. But I'll leave that up to Yordan to decide ;-)

Reviewed-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>


-- Steve
 
>  	KsUtils::setElidedText(&_hostFileLabel,




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux