Skip to contentSkip to conversation

dmesg: avoid mess at the end of dmesg output

PATCH Applied Petr Uzel 2 participants 2 messages Aug 10, 2011 – Aug 15, 2011 Util-Linux package

lore
Share & tools
lore

Petr Uzel

author
#0 lore raw

PATCH 1/1 dmesg: avoid mess at the end of dmesg output

Since util-linux commit a7ee94f2204011f26232ed3133514bf6e0d4a62c, dmesg incorrectly calculates number of bytes that are remaining in the buffer in get_next_record(). This could, under specific circumstances, cause printing mess at the end of dmesg output:

Quoted 1 line

dmesg | tail

[ 1191.478725] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
[ 1205.588331] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k

\xffffffba\xffffffba

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710417

---
 sys-utils/dmesg.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sys-utils/dmesg.c +2 -0
index 94f8c11..705269d 100644
@@ -494,6 +494,8 @@ static int get_next_record(struct dmesg_control *ctl, struct dmesg_record *rec)
 
 		rec->next_size -= end - rec->next;
 		rec->next = rec->next_size > 0 ? end + 1 : NULL;
+		if (rec->next_size > 0)
+			rec->next_size--;
 
 		return 0;
 	}
Signature · 8 lines
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode
maintainer Applied
#1 lore raw
Quoted 2 lines · Petr Uzel
 sys-utils/dmesg.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com