[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140417180452.GI7422@krava.brq.redhat.com>
Date: Thu, 17 Apr 2014 20:04:52 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Cody P Schafer <cody@...ux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>,
Borislav Petkov <bp@...e.de>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] tools/perf: allow overriding sysfs and proc finding
with env var
On Wed, Apr 16, 2014 at 01:39:46PM -0700, Cody P Schafer wrote:
SNIP
> +
> +/*
> + * Check for "NAME_PATH" environment variable to override fs location (for
> + * testing). This matches the recommendation in Documentation/sysfs-rules.txt
> + * for SYSFS_PATH.
> + */
> +static bool fs__env_override(struct fs *fs)
> +{
> + char *override_path;
> + size_t name_len = strlen(fs->name);
> + /* name + "_PATH" + '\0' */
> + char upper_name[name_len + 5 + 1];
> + memcpy(upper_name, fs->name, name_len);
> + mem_toupper(upper_name, name_len);
> + strcpy(&upper_name[name_len], "_PATH");
> +
> + override_path = getenv(upper_name);
> + if (!override_path)
> + return false;
> +
> + fs->found = true;
> + strcpy(fs->path, override_path);
please use strncpy with size of fs->path
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists