Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1710337 > unrolled thread
| Started by | Michael Sartain <mikesart@fastmail.com> |
|---|---|
| First post | 2017-08-12 19:40 +0200 |
| Last post | 2017-08-12 19:50 +0200 |
| Articles | 4 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/5] trace-cmd: Fixes for four small bugs plus minor cleanup Michael Sartain <mikesart@fastmail.com> - 2017-08-12 19:40 +0200
[PATCH 1/5] trace-cmd: Fix incorrect malloc size arg: *item instead of item Michael Sartain <mikesart@fastmail.com> - 2017-08-12 19:50 +0200
[PATCH 3/5] trace-cmd: Add ULL suffix to MISSING_EVENTS since ints shouldn't be left shifted by 31 Michael Sartain <mikesart@fastmail.com> - 2017-08-12 19:50 +0200
[PATCH 4/5] trace-cmd: Use unsigned values in Hsieh's trace_hash fast hash function Michael Sartain <mikesart@fastmail.com> - 2017-08-12 19:50 +0200
| From | Michael Sartain <mikesart@fastmail.com> |
|---|---|
| Date | 2017-08-12 19:40 +0200 |
| Subject | [PATCH 0/5] trace-cmd: Fixes for four small bugs plus minor cleanup |
| Message-ID | <udIye-3S9-23@gated-at.bofh.it> |
Thanks much.
-Mike
---
Michael Sartain (5):
trace-cmd: Fix incorrect malloc size arg: *item instead of item
trace-cmd: Fix NULL pointer being passed to memcpy
trace-cmd: Add ULL suffix to MISSING_EVENTS since ints shouldn't be
left shifted by 31
trace-cmd: Use unsigned values in Hsieh's trace_hash fast hash
function
trace-cmd: Remove unused view_width variable
kbuffer-parse.c | 4 ++--
trace-dialog.c | 2 +-
trace-graph.c | 2 --
trace-hash-local.h | 4 ++--
trace-output.c | 6 +++++-
5 files changed, 10 insertions(+), 8 deletions(-)
--
2.13.2
[toc] | [next] | [standalone]
| From | Michael Sartain <mikesart@fastmail.com> |
|---|---|
| Date | 2017-08-12 19:50 +0200 |
| Subject | [PATCH 1/5] trace-cmd: Fix incorrect malloc size arg: *item instead of item |
| Message-ID | <udIHT-3VV-3@gated-at.bofh.it> |
| In reply to | #1710337 |
Signed-off-by: Michael Sartain <mikesart@fastmail.com>
---
trace-dialog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/trace-dialog.c b/trace-dialog.c
index b5776cc..87e597a 100644
--- a/trace-dialog.c
+++ b/trace-dialog.c
@@ -97,7 +97,7 @@ static void push_cursor(GdkCursor *cursor)
{
struct cursor_stack *item;
- item = malloc_or_die(sizeof(item));
+ item = malloc_or_die(sizeof(*item));
item->next = cursor_stack;
cursor_stack = item;
item->cursor = cursor;
--
2.13.2
[toc] | [prev] | [next] | [standalone]
| From | Michael Sartain <mikesart@fastmail.com> |
|---|---|
| Date | 2017-08-12 19:50 +0200 |
| Subject | [PATCH 3/5] trace-cmd: Add ULL suffix to MISSING_EVENTS since ints shouldn't be left shifted by 31 |
| Message-ID | <udIHU-3VV-9@gated-at.bofh.it> |
| In reply to | #1710337 |
Signed-off-by: Michael Sartain <mikesart@fastmail.com> --- kbuffer-parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kbuffer-parse.c b/kbuffer-parse.c index 4e6e95e..dde642c 100644 --- a/kbuffer-parse.c +++ b/kbuffer-parse.c @@ -24,8 +24,8 @@ #include "kbuffer.h" -#define MISSING_EVENTS (1 << 31) -#define MISSING_STORED (1 << 30) +#define MISSING_EVENTS (1ULL << 31) +#define MISSING_STORED (1ULL << 30) #define COMMIT_MASK ((1 << 27) - 1) -- 2.13.2
[toc] | [prev] | [next] | [standalone]
| From | Michael Sartain <mikesart@fastmail.com> |
|---|---|
| Date | 2017-08-12 19:50 +0200 |
| Subject | [PATCH 4/5] trace-cmd: Use unsigned values in Hsieh's trace_hash fast hash function |
| Message-ID | <udIHU-3VV-5@gated-at.bofh.it> |
| In reply to | #1710337 |
Signed int values were being used where the original code used uint32_t types:
http://www.azillionmonkeys.com/qed/hash.html
Right shifting negative int values has implementation-defined and left shifting
has undefined behavior.
On my platform (x86_64) right shifting was doing sign extension and filling
high bits with 1s, which is different than the original algorithm.
Signed-off-by: Michael Sartain <mikesart@fastmail.com>
---
trace-hash-local.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/trace-hash-local.h b/trace-hash-local.h
index b2a1002..b3f9b06 100644
--- a/trace-hash-local.h
+++ b/trace-hash-local.h
@@ -22,7 +22,7 @@
static inline unsigned int trace_hash(int val)
{
- int hash, tmp;
+ unsigned int hash, tmp;
hash = 12546869; /* random prime */
@@ -34,7 +34,7 @@ static inline unsigned int trace_hash(int val)
*/
hash += (val & 0xffff);
- tmp = (val >> 16) ^ hash;
+ tmp = ((unsigned int)val >> 16) ^ hash;
hash = (hash << 16) ^ tmp;
hash += hash >> 11;
--
2.13.2
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web