<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/linux/string.h, branch v2.6.26-rc5</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Add a new sysfs_streq() string comparison function</title>
<updated>2008-05-01T15:03:59+00:00</updated>
<author>
<name>David Brownell</name>
<email>david-b@pacbell.net</email>
</author>
<published>2008-05-01T11:34:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=34990cf702bdf2b4964e0629dab4af7669f8b2c5'/>
<id>34990cf702bdf2b4964e0629dab4af7669f8b2c5</id>
<content type='text'>
Add a new sysfs_streq() string comparison function, which ignores
the trailing newlines found in sysfs inputs.  By example:

	sysfs_streq("a", "b")	==&gt; false
	sysfs_streq("a", "a")	==&gt; true
	sysfs_streq("a", "a\n")	==&gt; true
	sysfs_streq("a\n", "a")	==&gt; true

This is intended to simplify parsing of sysfs inputs, letting them
avoid the need to manually strip off newlines from inputs.

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Acked-by: Greg KH &lt;greg@kroah.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a new sysfs_streq() string comparison function, which ignores
the trailing newlines found in sysfs inputs.  By example:

	sysfs_streq("a", "b")	==&gt; false
	sysfs_streq("a", "a")	==&gt; true
	sysfs_streq("a", "a\n")	==&gt; true
	sysfs_streq("a\n", "a")	==&gt; true

This is intended to simplify parsing of sysfs inputs, letting them
avoid the need to manually strip off newlines from inputs.

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Acked-by: Greg KH &lt;greg@kroah.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[TIPC]: Fix headercheck wrt. tipc_config.h</title>
<updated>2007-10-31T04:44:00+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@sunset.davemloft.net</email>
</author>
<published>2007-10-31T04:44:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=97ef1bb0c8e371b7988287f38bd107c4aa14d78d'/>
<id>97ef1bb0c8e371b7988287f38bd107c4aa14d78d</id>
<content type='text'>
It wants string functions like memcpy() for inline
routines, and these define userland interfaces.

The only clean way to deal with this is to simply
put linux/string.h into unifdef-y and have it
include &lt;string.h&gt; when not-__KERNEL__.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It wants string functions like memcpy() for inline
routines, and these define userland interfaces.

The only clean way to deal with this is to simply
put linux/string.h into unifdef-y and have it
include &lt;string.h&gt; when not-__KERNEL__.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>add argv_split()</title>
<updated>2007-07-18T15:47:40+00:00</updated>
<author>
<name>Jeremy Fitzhardinge</name>
<email>jeremy@xensource.com</email>
</author>
<published>2007-07-18T01:37:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d84d1cc7647c7e4f77d517e2d87b4a106a0420d9'/>
<id>d84d1cc7647c7e4f77d517e2d87b4a106a0420d9</id>
<content type='text'>
argv_split() is a helper function which takes a string, splits it at
whitespace, and returns a NULL-terminated argv vector.  This is
deliberately simple - it does no quote processing of any kind.

[ Seems to me that this is something which is already being done in
  the kernel, but I couldn't find any other implementations, either to
  steal or replace.  Keep an eye out. ]

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
argv_split() is a helper function which takes a string, splits it at
whitespace, and returns a NULL-terminated argv vector.  This is
deliberately simple - it does no quote processing of any kind.

[ Seems to me that this is something which is already being done in
  the kernel, but I couldn't find any other implementations, either to
  steal or replace.  Keep an eye out. ]

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>add kstrndup</title>
<updated>2007-07-18T15:47:39+00:00</updated>
<author>
<name>Jeremy Fitzhardinge</name>
<email>jeremy@xensource.com</email>
</author>
<published>2007-07-18T01:37:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1e66df3ee301209f4a38df097d7cc5cb9b367a3f'/>
<id>1e66df3ee301209f4a38df097d7cc5cb9b367a3f</id>
<content type='text'>
Add a kstrndup function, modelled on strndup.  Like strndup this
returns a string copied into its own allocated memory, but it copies
no more than the specified number of bytes from the source.

Remove private strndup() from irda code.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Cc: YOSHIFUJI Hideaki &lt;yoshfuji@linux-ipv6.org&gt;
Cc: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@mandriva.com&gt;
Cc: Al Viro &lt;viro@ftp.linux.org.uk&gt;
Cc: Panagiotis Issaris &lt;takis@issaris.org&gt;
Cc: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a kstrndup function, modelled on strndup.  Like strndup this
returns a string copied into its own allocated memory, but it copies
no more than the specified number of bytes from the source.

Remove private strndup() from irda code.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@xensource.com&gt;
Signed-off-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Cc: YOSHIFUJI Hideaki &lt;yoshfuji@linux-ipv6.org&gt;
Cc: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@mandriva.com&gt;
Cc: Al Viro &lt;viro@ftp.linux.org.uk&gt;
Cc: Panagiotis Issaris &lt;takis@issaris.org&gt;
Cc: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[STRING]: Move strcasecmp/strncasecmp to lib/string.c</title>
<updated>2007-04-26T08:54:39+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@sunset.davemloft.net</email>
</author>
<published>2007-03-29T08:18:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ded220bd8f0823771fc0a9bdf7f5bcbe543197b6'/>
<id>ded220bd8f0823771fc0a9bdf7f5bcbe543197b6</id>
<content type='text'>
We have several platforms using local copies of identical
code.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have several platforms using local copies of identical
code.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] kmemdup: introduce</title>
<updated>2006-10-01T07:39:19+00:00</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2006-10-01T06:27:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1a2f67b459bb7846d4a15924face63eb2683acc2'/>
<id>1a2f67b459bb7846d4a15924face63eb2683acc2</id>
<content type='text'>
One of idiomatic ways to duplicate a region of memory is

	dst = kmalloc(len, GFP_KERNEL);
	if (!dst)
		return -ENOMEM;
	memcpy(dst, src, len);

which is neat code except a programmer needs to write size twice.  Which
sometimes leads to mistakes.  If len passed to kmalloc is smaller that len
passed to memcpy, it's straight overwrite-beyond-end.  If len passed to
memcpy is smaller than len passed to kmalloc, it's either a) legit
behaviour ;-), or b) cloned buffer will contain garbage in second half.

Slight trolling of commit lists shows several duplications bugs
done exactly because of diverged lenghts:

	Linux:
		[CRYPTO]: Fix memcpy/memset args.
		[PATCH] memcpy/memset fixes
	OpenBSD:
		kerberosV/src/lib/asn1: der_copy.c:1.4

If programmer is given only one place to play with lengths, I believe, such
mistakes could be avoided.

With kmemdup, the snippet above will be rewritten as:

	dst = kmemdup(src, len, GFP_KERNEL);
	if (!dst)
		return -ENOMEM;

This also leads to smaller code (kzalloc effect). Quick grep shows
200+ places where kmemdup() can be used.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
One of idiomatic ways to duplicate a region of memory is

	dst = kmalloc(len, GFP_KERNEL);
	if (!dst)
		return -ENOMEM;
	memcpy(dst, src, len);

which is neat code except a programmer needs to write size twice.  Which
sometimes leads to mistakes.  If len passed to kmalloc is smaller that len
passed to memcpy, it's straight overwrite-beyond-end.  If len passed to
memcpy is smaller than len passed to kmalloc, it's either a) legit
behaviour ;-), or b) cloned buffer will contain garbage in second half.

Slight trolling of commit lists shows several duplications bugs
done exactly because of diverged lenghts:

	Linux:
		[CRYPTO]: Fix memcpy/memset args.
		[PATCH] memcpy/memset fixes
	OpenBSD:
		kerberosV/src/lib/asn1: der_copy.c:1.4

If programmer is given only one place to play with lengths, I believe, such
mistakes could be avoided.

With kmemdup, the snippet above will be rewritten as:

	dst = kmemdup(src, len, GFP_KERNEL);
	if (!dst)
		return -ENOMEM;

This also leads to smaller code (kzalloc effect). Quick grep shows
200+ places where kmemdup() can be used.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] strstrip() API</title>
<updated>2006-06-23T14:43:06+00:00</updated>
<author>
<name>Pekka Enberg</name>
<email>penberg@cs.helsinki.fi</email>
</author>
<published>2006-06-23T09:05:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=481fad483487ea967fe20bbc9e565d787f7bf20f'/>
<id>481fad483487ea967fe20bbc9e565d787f7bf20f</id>
<content type='text'>
Add a new strstrip() function to lib/string.c for removing leading and
trailing whitespace from a string.

Cc: Michael Holzheu &lt;holzheu@de.ibm.com&gt;
Acked-by: Ingo Oeser &lt;ioe-lkml@rameria.de&gt;
Acked-by: Joern Engel &lt;joern@wohnheim.fh-wedel.de&gt;
Cc: Corey Minyard &lt;minyard@acm.org&gt;
Signed-off-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Acked-by: Michael Holzheu &lt;HOLZHEU@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a new strstrip() function to lib/string.c for removing leading and
trailing whitespace from a string.

Cc: Michael Holzheu &lt;holzheu@de.ibm.com&gt;
Acked-by: Ingo Oeser &lt;ioe-lkml@rameria.de&gt;
Acked-by: Joern Engel &lt;joern@wohnheim.fh-wedel.de&gt;
Cc: Corey Minyard &lt;minyard@acm.org&gt;
Signed-off-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Acked-by: Michael Holzheu &lt;HOLZHEU@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] Clean up arch-overrides in linux/string.h</title>
<updated>2006-04-11T13:18:40+00:00</updated>
<author>
<name>Kyle McMartin</name>
<email>kyle@parisc-linux.org</email>
</author>
<published>2006-04-11T05:53:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8833d328caf009f8da58337e17a2cf5d52993a7c'/>
<id>8833d328caf009f8da58337e17a2cf5d52993a7c</id>
<content type='text'>
Some string functions were safely overrideable in lib/string.c, but their
corresponding declarations in linux/string.h were not.  Correct this, and
make strcspn overrideable.

Odds of someone wanting to do optimized assembly of these are small, but
for the sake of cleanliness, might as well bring them into line with the
rest of the file.

Signed-off-by: Kyle McMartin &lt;kyle@parisc-linux.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some string functions were safely overrideable in lib/string.c, but their
corresponding declarations in linux/string.h were not.  Correct this, and
make strcspn overrideable.

Odds of someone wanting to do optimized assembly of these are small, but
for the sake of cleanliness, might as well bring them into line with the
rest of the file.

Signed-off-by: Kyle McMartin &lt;kyle@parisc-linux.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] strndup_user()</title>
<updated>2006-03-24T15:33:31+00:00</updated>
<author>
<name>Davi Arnaut</name>
<email>davi.arnaut@gmail.com</email>
</author>
<published>2006-03-24T11:18:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=96840aa00a031069a136ec4c55d0bdd09ac6d3a7'/>
<id>96840aa00a031069a136ec4c55d0bdd09ac6d3a7</id>
<content type='text'>
This patch series creates a strndup_user() function to easy copying C strings
from userspace.  Also we avoid common pitfalls like userspace modifying the
final \0 after the strlen_user().

Signed-off-by: Davi Arnaut &lt;davi.arnaut@gmail.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch series creates a strndup_user() function to easy copying C strings
from userspace.  Also we avoid common pitfalls like userspace modifying the
final \0 after the strlen_user().

Signed-off-by: Davi Arnaut &lt;davi.arnaut@gmail.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] gfp flags annotations - part 1</title>
<updated>2005-10-08T22:00:57+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@ftp.linux.org.uk</email>
</author>
<published>2005-10-07T06:46:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=dd0fc66fb33cd610bc1a5db8a5e232d34879b4d7'/>
<id>dd0fc66fb33cd610bc1a5db8a5e232d34879b4d7</id>
<content type='text'>
 - added typedef unsigned int __nocast gfp_t;

 - replaced __nocast uses for gfp flags with gfp_t - it gives exactly
   the same warnings as far as sparse is concerned, doesn't change
   generated code (from gcc point of view we replaced unsigned int with
   typedef) and documents what's going on far better.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 - added typedef unsigned int __nocast gfp_t;

 - replaced __nocast uses for gfp flags with gfp_t - it gives exactly
   the same warnings as far as sparse is concerned, doesn't change
   generated code (from gcc point of view we replaced unsigned int with
   typedef) and documents what's going on far better.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
