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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 17 Mar 2011 23:32:50 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Jonathan Corbet <corbet@....net>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andy Whitcroft <apw@...dowen.org>,
	Dave Jones <davej@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] checkpatch: Test for kmalloc/memset(0) pairs

On Thu, 2011-03-17 at 21:15 -0600, Jonathan Corbet wrote:
> On Thu, 17 Mar 2011 22:52:24 -0400
> Steven Rostedt <rostedt@...dmis.org> wrote:
> 
> > The use of kzalloc() is preferred over kmalloc/memset(0) pairs.
> > 
> > When a match is made with "memset(p, 0, s);" a search back through the
> > patch hunk is made looking for "p = kmalloc(s,". If that is found, then
> > a warning is given, suggesting to use kzalloc() instead.
> 
> The Coccinelle stuff already has a lot of this kind of test.  See, for
> example, scripts/coccinelle/api/alloc/kzalloc-simple.cocci.  Suppose
> there is some way all this nice analysis infrastructure could be
> integrated instead of duplicated?  Or am I just a crazy dreamer?
> 

Hmm, to me Coccinelle is sorta the big hammer approach to this. It can
be used to analyze the kernel code that exists. checkpatch is made to
stop developers from adding new crap.

That said, I wonder if there is a way to make one use information from
the other. Perhaps we can make checkpatch read the Concinelle rules.
Honestly, I've never used Concinelle and have no idea how to use it.
Looking at their web site there's a PDF on how to use something called
"spatch" but it seems more complex than checkpatch.

But if we can teach checkpatch to read the rule files, then maybe that
would be beneficial.

-- Steve


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