diff options
author | Yordan Karadzhov <ykaradzhov@vmware.com> | 2019-04-22 15:37:53 +0300 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2019-04-23 10:36:11 -0400 |
commit | 93ee67da48016b9f645748eb5961ff890ee33937 (patch) | |
tree | 1366fb9d4380fd70d3bce7adff75bcdc5e8a8f8f | |
parent | 0cf1f479f11e22f0e36f79bae15bfcf26907fa45 (diff) | |
download | trace-cmd-93ee67da48016b9f645748eb5961ff890ee33937.tar.gz |
kernel-shark: Fixing the fix in ksmodel_zoom
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
Link: http://lore.kernel.org/linux-trace-devel/20190422123753.3821-1-ykaradzhov@vmware.com
Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Fixes: bedcff1165 ("kernel-shark: Fix a bug in ksmodel_zoom")
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | kernel-shark/src/libkshark-model.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c index 29676c75..978cd70a 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; /* |