|
Jerome Marchand |
3772ca |
From 48e906bceb8b4770bfcbaf481338c134658ce2c8 Mon Sep 17 00:00:00 2001
|
|
Jerome Marchand |
3772ca |
From: Jerome Marchand <jmarchan@redhat.com>
|
|
Jerome Marchand |
3772ca |
Date: Thu, 6 Jun 2024 17:38:25 +0200
|
|
Jerome Marchand |
3772ca |
Subject: [PATCH 11/15] libtracefs: my_yyinput() should return 0 when no data
|
|
Jerome Marchand |
3772ca |
can be read
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
YY_INPUT() is redefined in sqlhist.l and basically just call
|
|
Jerome Marchand |
3772ca |
my_yyinput() to do the work. However, YY_INPUT is supposed to return
|
|
Jerome Marchand |
3772ca |
YY_NULL (0 on Unix system) when no data can be read, not -1. This can
|
|
Jerome Marchand |
3772ca |
cause an overflow error in the generated sqlhist-lex.c file.
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Have my_yyinput() returns zero when no buffer is found.
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Link: https://lore.kernel.org/linux-trace-devel/20240606153830.2666120-12-jmarchan@redhat.com
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Fixes: 25446407c5151 ("libtracefs: Added new API tracefs_sql()")
|
|
Jerome Marchand |
3772ca |
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
|
Jerome Marchand |
3772ca |
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
|
|
Jerome Marchand |
3772ca |
---
|
|
Jerome Marchand |
3772ca |
src/tracefs-sqlhist.c | 2 +-
|
|
Jerome Marchand |
3772ca |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
|
|
Jerome Marchand |
3772ca |
index c7b9eff..0f678c1 100644
|
|
Jerome Marchand |
3772ca |
--- a/src/tracefs-sqlhist.c
|
|
Jerome Marchand |
3772ca |
+++ b/src/tracefs-sqlhist.c
|
|
Jerome Marchand |
3772ca |
@@ -121,7 +121,7 @@ __hidden int my_yyinput(void *extra, char *buf, int max)
|
|
Jerome Marchand |
3772ca |
struct sqlhist_bison *sb = extra;
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
if (!sb || !sb->buffer)
|
|
Jerome Marchand |
3772ca |
- return -1;
|
|
Jerome Marchand |
3772ca |
+ return 0;
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
if (sb->buffer_idx + max > sb->buffer_size)
|
|
Jerome Marchand |
3772ca |
max = sb->buffer_size - sb->buffer_idx;
|
|
Jerome Marchand |
3772ca |
--
|
|
Jerome Marchand |
3772ca |
2.45.2
|
|
Jerome Marchand |
3772ca |
|