Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] libtracefs: Fix bug in tracefs_instances()
@ 2021-07-07 13:05 Yordan Karadzhov (VMware)
  2021-07-07 13:47 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-07-07 13:05 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

The empty string is now made of two elements, because of the hidden
first element that stores its size.

Fixes: 056a177 (libtracefs: Restructure how string lists work)
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/tracefs-instance.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
index 11fb580..d601db2 100644
--- a/src/tracefs-instance.c
+++ b/src/tracefs-instance.c
@@ -694,7 +694,7 @@ char **tracefs_instances(const char *regex)
 	} else {
 		/* No matches should produce an empty list */
 		if (!list.list)
-			list.list = calloc(1, sizeof(*list.list));
+			list.list = trace_list_create_empty();
 	}
 	return list.list;
 }
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libtracefs: Fix bug in tracefs_instances()
  2021-07-07 13:05 [PATCH] libtracefs: Fix bug in tracefs_instances() Yordan Karadzhov (VMware)
@ 2021-07-07 13:47 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2021-07-07 13:47 UTC (permalink / raw)
  To: Yordan Karadzhov (VMware); +Cc: linux-trace-devel

On Wed,  7 Jul 2021 16:05:23 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> The empty string is now made of two elements, because of the hidden
> first element that stores its size.
> 
> Fixes: 056a177 (libtracefs: Restructure how string lists work)
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
>  src/tracefs-instance.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
> index 11fb580..d601db2 100644
> --- a/src/tracefs-instance.c
> +++ b/src/tracefs-instance.c
> @@ -694,7 +694,7 @@ char **tracefs_instances(const char *regex)
>  	} else {
>  		/* No matches should produce an empty list */
>  		if (!list.list)
> -			list.list = calloc(1, sizeof(*list.list));
> +			list.list = trace_list_create_empty();
>  	}
>  	return list.list;
>  }

Thanks! I guess I missed one :-p

-- Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 13:05 [PATCH] libtracefs: Fix bug in tracefs_instances() Yordan Karadzhov (VMware)
2021-07-07 13:47 ` Steven Rostedt

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git