Commit a529bec0 authored by Dima Kogan's avatar Dima Kogan Committed by Arnaldo Carvalho de Melo
Browse files

perf probe-event: Un-hardcode sizeof(buf)



In several places we had

  char buf[64];
  ...
  snprintf(buf, 64, ...);

This patch changes it to

  char buf[64];
  ...
  snprintf(buf, sizeof(buf), ...);

so the "64" is only stated once.

Signed-off-by: default avatarDima Kogan <dima@secretsauce.net>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20240416045533.162692-2-dima@secretsauce.net


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 03f23570
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ static int convert_exec_to_group(const char *exec, char **result)
		}
	}

	ret = e_snprintf(buf, 64, "%s_%s", PERFPROBE_GROUP, ptr1);
	ret = e_snprintf(buf, sizeof(buf), "%s_%s", PERFPROBE_GROUP, ptr1);
	if (ret < 0)
		goto out;

@@ -2867,7 +2867,7 @@ static int probe_trace_event__set_name(struct probe_trace_event *tev,
		group = PERFPROBE_GROUP;

	/* Get an unused new event name */
	ret = get_new_event_name(buf, 64, event, namelist,
	ret = get_new_event_name(buf, sizeof(buf), event, namelist,
				 tev->point.retprobe, allow_suffix);
	if (ret < 0)
		return ret;