mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Borislav Petkov <bp@suse.de>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] tools/perf: allow overriding sysfs and proc finding with env var
Date: Thu, 17 Apr 2014 20:04:52 +0200	[thread overview]
Message-ID: <20140417180452.GI7422@krava.brq.redhat.com> (raw)
In-Reply-To: <1397680812-21588-1-git-send-email-cody@linux.vnet.ibm.com>

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

      reply	other threads:[~2014-04-17 18:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16 20:39 Cody P Schafer
2014-04-17 18:04 ` Jiri Olsa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140417180452.GI7422@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=bp@suse.de \
    --cc=cody@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®