if (zoom_in && (int) range * (1. - r) < histo->n_bins * 5) The line above has two bugs: - 64 bit type (size_t) is casted to 32 bit (int) - Type cast operator has a higher precedence than the multiplication operator, hence "(int) range * (1. - r)" is a floating point number Reported-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> Fixes: bedcff1165 ("kernel-shark: Fix a bug in ksmodel_zoom") Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> --- kernel-shark/src/libkshark-model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c index 29676c7..978cd70 100644 --- a/kernel-shark/src/libkshark-model.c +++ b/kernel-shark/src/libkshark-model.c @@ -649,7 +649,7 @@ static void ksmodel_zoom(struct kshark_trace_histo *histo, * Avoid overzooming. If needed, adjust the Scale factor to a the value * which provides bin_size >= 5. */ - if (zoom_in && (int) range * (1. - r) < histo->n_bins * 5) + if (zoom_in && (size_t) (range * (1. - r)) < histo->n_bins * 5) r = 1. - (histo->n_bins * 5.) / range; /* -- 2.20.1