* [PATCH] perf util config : Modify size factor of snprintf
@ 2018-12-01 15:46 Sihyeon Jang
2018-12-06 17:09 ` Arnaldo Carvalho de Melo
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sihyeon Jang @ 2018-12-01 15:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Sihyeon Jang
According to definition of snprintf, it gets size factor including null('\0') byte.
So '-1' is not neccessary. Also it will be helpful unfied style with other cases. (eg. builtin-script.c)
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
---
tools/perf/util/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 5ac157056cdf..bce980fa9f41 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -811,14 +811,14 @@ int config_error_nonbool(const char *var)
void set_buildid_dir(const char *dir)
{
if (dir)
- scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
+ scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
/* default to $HOME/.debug */
if (buildid_dir[0] == '\0') {
char *home = getenv("HOME");
if (home) {
- snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
+ snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
home, DEBUG_CACHE_DIR);
} else {
strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf util config : Modify size factor of snprintf
2018-12-01 15:46 [PATCH] perf util config : Modify size factor of snprintf Sihyeon Jang
@ 2018-12-06 17:09 ` Arnaldo Carvalho de Melo
2018-12-14 20:59 ` [tip:perf/core] perf config: " tip-bot for Sihyeon Jang
2018-12-18 14:26 ` tip-bot for Sihyeon Jang
2 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-12-06 17:09 UTC (permalink / raw)
To: Sihyeon Jang; +Cc: linux-kernel, Jiri Olsa, Namhyung Kim
Em Sun, Dec 02, 2018 at 12:46:03AM +0900, Sihyeon Jang escreveu:
> According to definition of snprintf, it gets size factor including null('\0') byte.
> So '-1' is not neccessary. Also it will be helpful unfied style with other cases. (eg. builtin-script.c)
Thanks, applied.
- Arnaldo
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
> ---
> tools/perf/util/config.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 5ac157056cdf..bce980fa9f41 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -811,14 +811,14 @@ int config_error_nonbool(const char *var)
> void set_buildid_dir(const char *dir)
> {
> if (dir)
> - scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
> + scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
>
> /* default to $HOME/.debug */
> if (buildid_dir[0] == '\0') {
> char *home = getenv("HOME");
>
> if (home) {
> - snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
> + snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
> home, DEBUG_CACHE_DIR);
> } else {
> strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
> --
> 2.17.1
--
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perf/core] perf config: Modify size factor of snprintf
2018-12-01 15:46 [PATCH] perf util config : Modify size factor of snprintf Sihyeon Jang
2018-12-06 17:09 ` Arnaldo Carvalho de Melo
@ 2018-12-14 20:59 ` tip-bot for Sihyeon Jang
2018-12-18 14:26 ` tip-bot for Sihyeon Jang
2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Sihyeon Jang @ 2018-12-14 20:59 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, jolsa, uneedsihyeon, linux-kernel, tglx, acme, namhyung, hpa
Commit-ID: 63ac3b59f0fba922f98537ada06bc2528d1d2702
Gitweb: https://git.kernel.org/tip/63ac3b59f0fba922f98537ada06bc2528d1d2702
Author: Sihyeon Jang <uneedsihyeon@gmail.com>
AuthorDate: Sun, 2 Dec 2018 00:46:03 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 6 Dec 2018 16:43:27 -0300
perf config: Modify size factor of snprintf
According to definition of snprintf, it gets size factor including
null('\0') byte. So '-1' is not neccessary. Also it will be helpful
unfied style with other cases. (eg. builtin-script.c)
Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20181201154603.10093-1-uneedsihyeon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 3beb4cf44c31..1ea8f898f1a1 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -815,14 +815,14 @@ int config_error_nonbool(const char *var)
void set_buildid_dir(const char *dir)
{
if (dir)
- scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
+ scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
/* default to $HOME/.debug */
if (buildid_dir[0] == '\0') {
char *home = getenv("HOME");
if (home) {
- snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
+ snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
home, DEBUG_CACHE_DIR);
} else {
strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [tip:perf/core] perf config: Modify size factor of snprintf
2018-12-01 15:46 [PATCH] perf util config : Modify size factor of snprintf Sihyeon Jang
2018-12-06 17:09 ` Arnaldo Carvalho de Melo
2018-12-14 20:59 ` [tip:perf/core] perf config: " tip-bot for Sihyeon Jang
@ 2018-12-18 14:26 ` tip-bot for Sihyeon Jang
2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Sihyeon Jang @ 2018-12-18 14:26 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, linux-kernel, namhyung, hpa, uneedsihyeon, acme, tglx, jolsa
Commit-ID: 75c375c0ae7cc75cec6683ee2539937c60c3e4af
Gitweb: https://git.kernel.org/tip/75c375c0ae7cc75cec6683ee2539937c60c3e4af
Author: Sihyeon Jang <uneedsihyeon@gmail.com>
AuthorDate: Sun, 2 Dec 2018 00:46:03 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 Dec 2018 14:59:40 -0300
perf config: Modify size factor of snprintf
According to definition of snprintf, it gets size factor including
null('\0') byte. So '-1' is not neccessary. Also it will be helpful
unfied style with other cases. (eg. builtin-script.c)
Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20181201154603.10093-1-uneedsihyeon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 3beb4cf44c31..1ea8f898f1a1 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -815,14 +815,14 @@ int config_error_nonbool(const char *var)
void set_buildid_dir(const char *dir)
{
if (dir)
- scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
+ scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
/* default to $HOME/.debug */
if (buildid_dir[0] == '\0') {
char *home = getenv("HOME");
if (home) {
- snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
+ snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
home, DEBUG_CACHE_DIR);
} else {
strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] perf util config : Modify size factor of snprintf
@ 2018-12-01 15:43 Sihyeon Jang
0 siblings, 0 replies; 5+ messages in thread
From: Sihyeon Jang @ 2018-12-01 15:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Sihyeon Jang
According to definition of snprintf, it gets size factor including null('\0') byte.
So '-1' is not neccessary. Also it will be helpful unfied style with other cases. (eg. builtin-script.c)
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
---
tools/perf/util/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 5ac157056cdf..bce980fa9f41 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -811,14 +811,14 @@ int config_error_nonbool(const char *var)
void set_buildid_dir(const char *dir)
{
if (dir)
- scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
+ scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
/* default to $HOME/.debug */
if (buildid_dir[0] == '\0') {
char *home = getenv("HOME");
if (home) {
- snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
+ snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
home, DEBUG_CACHE_DIR);
} else {
strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-12-18 14:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01 15:46 [PATCH] perf util config : Modify size factor of snprintf Sihyeon Jang
2018-12-06 17:09 ` Arnaldo Carvalho de Melo
2018-12-14 20:59 ` [tip:perf/core] perf config: " tip-bot for Sihyeon Jang
2018-12-18 14:26 ` tip-bot for Sihyeon Jang
-- strict thread matches above, loose matches on Subject: below --
2018-12-01 15:43 [PATCH] perf util config : " Sihyeon Jang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).