lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140609094828.011b0eb8@gandalf.local.home>
Date:	Mon, 9 Jun 2014 09:48:28 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Namhyung Kim <namhyung@...il.com>
Cc:	Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@...achi.com>,
	linux-kernel@...r.kernel.org,
	Hidehiro Kawai <hidehiro.kawai.ez@...achi.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Ingo Molnar <mingo@...hat.com>, yrl.pp-manager.tt@...achi.com
Subject: Re: [PATCH ftrace/core V5] ftrace: Introduce saved_cmdlines_size
 file

On Mon, 09 Jun 2014 17:21:12 +0900
Namhyung Kim <namhyung@...il.com> wrote:

> Hi Yoshihiro,
> 
> Sorry for being late, but just wanna give you some (minor) feedbacks..
> 
> 
> On Thu, 05 Jun 2014 10:24:27 +0900, Yoshihiro YUNOMAE wrote:
> > +static int trace_create_savedcmd(void)
> > +{
> > +	int ret;
> > +
> > +	savedcmd = kmalloc(sizeof(struct saved_cmdlines_buffer), GFP_KERNEL);
> 
> s/sizeof(struct saved_cmdlines_buffer)/sizeof(*savedcmd)/
> 
> 
> > +	if (!savedcmd)
> > +		return -ENOMEM;
> > +
> > +	ret = allocate_cmdlines_buffer(SAVED_CMDLINES_DEFAULT, savedcmd);
> > +	if (ret < 0) {
> > +		kfree(savedcmd);
> > +		savedcmd = NULL;
> > +		return -ENOMEM;
> > +	}
> > +
> > +	return 0;
> >  }
> 
> [SNIP]
> >  static ssize_t
> > +tracing_saved_cmdlines_size_read(struct file *filp, char __user *ubuf,
> > +				 size_t cnt, loff_t *ppos)
> > +{
> > +	char buf[64];
> > +	int r;
> > +
> > +	arch_spin_lock(&trace_cmdline_lock);
> > +	r = sprintf(buf, "%u\n", savedcmd->cmdline_num);
> 
> In general, it's better to use scnprintf() instead.
> 
> 
> > +	arch_spin_unlock(&trace_cmdline_lock);
> > +
> > +	return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
> > +}
> > +
> > +static void free_saved_cmdlines_buffer(struct saved_cmdlines_buffer *s)
> > +{
> > +	kfree(s->saved_cmdlines);
> > +	kfree(s->map_cmdline_to_pid);
> > +	kfree(s);
> > +}
> > +
> > +static int tracing_resize_saved_cmdlines(unsigned int val)
> > +{
> > +	struct saved_cmdlines_buffer *s, *savedcmd_temp;
> > +
> > +	s = kmalloc(sizeof(struct saved_cmdlines_buffer), GFP_KERNEL);
> 
> s/sizeof(struct saved_cmdlines_buffer)/sizeof(*s)/
> 

I already pushed this to Linus. He hasn't pulled yet, but if you want
to send a patch against my ftrace/core, I'll add that. These are minor
enough to get into the merge window still.

-- Steve


> Thanks,
> Namhyung
> 
> 
> > +	if (!s)
> > +		return -ENOMEM;
> > +
> > +	if (allocate_cmdlines_buffer(val, s) < 0) {
> > +		kfree(s);
> > +		return -ENOMEM;
> > +	}
> > +
> > +	arch_spin_lock(&trace_cmdline_lock);
> > +	savedcmd_temp = savedcmd;
> > +	savedcmd = s;
> > +	arch_spin_unlock(&trace_cmdline_lock);
> > +	free_saved_cmdlines_buffer(savedcmd_temp);
> > +
> > +	return 0;
> > +}

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ