On Fri, Oct 16, 2026 at 05:39:51AM +0000, [email protected] wrote:
> Does this code underflow the pointer arithmetic if kmsg_len is 1?

Yes, when a chunk holds only an empty line. The pointer is then only
compared, never read, and nothing is drawn.

> Does the strict inequality prematurely terminate parsing? It appears it
> would silently drop 1-char lines.

Yes, when the one character line is the first in a chunk. Anywhere else
it is drawn.

> It also seems to skip the first log line of every kmsg dump chunk,
> because the loop stops before processing when start reaches kmsg_buf.

No, a normal first line is drawn.

Both real cases need printk timestamps off, and both also happen without
this patch. QEMU on drm-misc-fixes, timestamps off, 10 runs each, with
and without this patch:

  normal line at a chunk start         drawn
  one character line at a chunk start  not drawn
  one character line mid chunk         drawn
  chunk of only an empty line          pointer one before the buffer,
                                       nothing drawn

With timestamps on, the one character line was drawn and no chunk held
only an empty line. Every run rebooted.

Devin

Reply via email to