Skip to contentSkip to conversation

seq_buf: fix a misleading comment

PATCH In review Jonathan Corbet 2 participants 2 messages Oct 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 seq_buf: fix a misleading comment

The comment for seq_buf_has_overflowed() says that an overflow condition is marked by len == size, but that's not what the code is testing. Make the comment match reality.

---
 include/linux/seq_buf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/seq_buf.h +1 -1
index 515d7fcb9634..026302765494 100644
@@ -39,7 +39,7 @@ seq_buf_init(struct seq_buf *s, char *buf, unsigned int size)
 
 /*
  * seq_buf have a buffer that might overflow. When this happens
- * the len and size are set to be equal.
+ * len is set to be greater than size.
  */
 static inline bool
 seq_buf_has_overflowed(struct seq_buf *s)
Signature · 1 line
2.41.0
#1 lore raw
Quoted 4 lines · On Fri, 20 Oct 2023 14:38:49 -0600 Jonathan Corbet <[email protected]> wrote:

The comment for seq_buf_has_overflowed() says that an overflow condition is marked by len == size, but that's not what the code is testing. Make the comment match reality.

I guess we can add:

Fixes 8cd709ae7658a ("tracing: Have seq_buf use full buffer")

Thanks!

-- Steve

Quoted 18 lines
---
 include/linux/seq_buf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/seq_buf.h +1 -1
index 515d7fcb9634..026302765494 100644
@@ -39,7 +39,7 @@ seq_buf_init(struct seq_buf *s, char *buf, unsigned int size)
 
 /*
  * seq_buf have a buffer that might overflow. When this happens
- * the len and size are set to be equal.
+ * len is set to be greater than size.
  */
 static inline bool
 seq_buf_has_overflowed(struct seq_buf *s)