gsmi: Fix bug in append_to_eventlog sysfs handler
[ Upstream commit 655603de68469adaff16842ac17a5aec9c9ce89b ] 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: NDuncan Laurie <dlaurie@chromium.org> Reviewed-by: NVadim Bendebury <vbendeb@chromium.org> Reviewed-by: NStefan Reinauer <reinauer@chromium.org> Signed-off-by: NFurquan Shaikh <furquan@google.com> Tested-by: NFurquan Shaikh <furquan@chromium.org> Reviewed-by: NAaron Durbin <adurbin@chromium.org> Reviewed-by: NJustin TerAvest <teravest@chromium.org> [zwisler: updated changelog for 2nd bug fix and upstream] Signed-off-by: NRoss Zwisler <zwisler@google.com> Reviewed-by: NGuenter Roeck <groeck@chromium.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: NSasha Levin <sashal@kernel.org>
Showing
想要评论请 注册 或 登录