Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wlcore: fix bug reading fwlog

With logging enabled, it has been observed that the driver spews
messages such as:

wlcore: ERROR Calculate of clear addr Clear = 204025b0, write = 204015b0

The problem occurs because 204025b0 is the end of the buffer, and
204015b0 is the beginning, and the calculation for "clear"ing the
buffer does not take into account that if we read to the very end
of the ring buffer, we are actually at the beginning of the buffer.

Fix this.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/E1lolvc-0003RM-VE@rmk-PC.armlinux.org.uk

authored by

Russell King and committed by
Kalle Valo
87ab9cba 98e94771

+2
+2
drivers/net/wireless/ti/wlcore/event.c
··· 84 84 len = min(actual_len, available_len); 85 85 wl12xx_copy_fwlog(wl, &buffer[start_loc], len); 86 86 clear_ptr = addr_ptr + start_loc + actual_len; 87 + if (clear_ptr == buff_end_ptr) 88 + clear_ptr = buff_start_ptr; 87 89 88 90 /* Copy any remaining part from beginning of ring buffer */ 89 91 len = actual_len - len;