diff options
author | Duncan Laurie <[email protected]> | 2018-10-12 10:04:45 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2018-10-15 20:32:26 +0200 |
commit | 655603de68469adaff16842ac17a5aec9c9ce89b (patch) | |
tree | b9abba9a202fdabb718d96ecd397e0b40f483723 /scripts/bpf_helpers_doc.py | |
parent | 4a2b2662e9d21648502e5be10dcd312b8fe85bca (diff) |
gsmi: Fix bug in append_to_eventlog sysfs handler
The sysfs handler should return the number of bytes consumed, which in the
case of a successful write is the entire buffer. Also fix a bug where
param.data_len was being set to (count - (2 * sizeof(u32))) instead of just
(count - sizeof(u32)). The latter is correct because we skip over the
leading u32 which is our param.type, but we were also incorrectly
subtracting sizeof(u32) on the line where we were actually setting
param.data_len:
param.data_len = count - sizeof(u32);
This meant that for our example event.kernel_software_watchdog with total
length 10 bytes, param.data_len was just 2 prior to this change.
To test, successfully append an event to the log with gsmi sysfs.
This sample event is for a "Kernel Software Watchdog"
> xxd -g 1 event.kernel_software_watchdog
0000000: 01 00 00 00 ad de 06 00 00 00
> cat event.kernel_software_watchdog > /sys/firmware/gsmi/append_to_eventlog
> mosys eventlog list | tail -1
14 | 2012-06-25 10:14:14 | Kernl Event | Software Watchdog
Signed-off-by: Duncan Laurie <[email protected]>
Reviewed-by: Vadim Bendebury <[email protected]>
Reviewed-by: Stefan Reinauer <[email protected]>
Signed-off-by: Furquan Shaikh <[email protected]>
Tested-by: Furquan Shaikh <[email protected]>
Reviewed-by: Aaron Durbin <[email protected]>
Reviewed-by: Justin TerAvest <[email protected]>
[zwisler: updated changelog for 2nd bug fix and upstream]
Signed-off-by: Ross Zwisler <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'scripts/bpf_helpers_doc.py')
0 files changed, 0 insertions, 0 deletions