Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-31 Thread Sebastian Capella
Quoting Pavel Machek (2014-01-31 04:24:21) > Well, your /sys/power/resume patch would be nice cleanup, but it > changs behaviour, too... which is unnice. Stripping trailing "\n" is > probably neccessary, because we did it before. (It probably was a > mistake). But kernel is not right place to secon

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-31 Thread Pavel Machek
Hi! On Fri 2014-01-31 02:46:08, David Rientjes wrote: > On Fri, 31 Jan 2014, Pavel Machek wrote: > > > > kstrimdup will duplicate and trim spaces from the passed in > > > null terminated string. This is useful for strings coming from > > > sysfs that often include trailing whitespace due to user

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-31 Thread David Rientjes
On Fri, 31 Jan 2014, Pavel Machek wrote: > > kstrimdup will duplicate and trim spaces from the passed in > > null terminated string. This is useful for strings coming from > > sysfs that often include trailing whitespace due to user input. > > Is it good idea? I mean "\n\n/foo bar baz" is valid

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-31 Thread Pavel Machek
On Wed 2014-01-29 15:48:23, Sebastian Capella wrote: > kstrimdup will duplicate and trim spaces from the passed in > null terminated string. This is useful for strings coming from > sysfs that often include trailing whitespace due to user input. Is it good idea? I mean "\n\n/foo bar baz" is valid

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-29 Thread Joe Perches
On Wed, 2014-01-29 at 19:41 -0800, Sebastian Capella wrote: > Quoting Joe Perches (2014-01-29 17:24:28) > > Why not minimize the malloc length too? > > > I figured it would be mostly for small trimming, but it seems like > it could be and advantage and used more generally this way. > > I have a

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-29 Thread Sebastian Capella
Quoting Joe Perches (2014-01-29 17:24:28) > Why not minimize the malloc length too? > > maybe something like: > > char *kstrimdup(const char *s, gfp_t gfp) > { > char *buf; > const char *begin = skip_spaces(s); > size_t len = strlen(begin); > > while (len && isspa

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-29 Thread Joe Perches
On Wed, 2014-01-29 at 19:58 -0500, Mikulas Patocka wrote: > On Wed, 29 Jan 2014, Sebastian Capella wrote: > > kstrimdup will duplicate and trim spaces from the passed in > > null terminated string. This is useful for strings coming from > > sysfs that often include trailing whitespace due to user

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-29 Thread Mikulas Patocka
On Wed, 29 Jan 2014, Mikulas Patocka wrote: > > > On Wed, 29 Jan 2014, Sebastian Capella wrote: > > > kstrimdup will duplicate and trim spaces from the passed in > > null terminated string. This is useful for strings coming from > > sysfs that often include trailing whitespace due to user in

Re: [PATCH v4 1/2] mm: add kstrimdup function

2014-01-29 Thread Mikulas Patocka
On Wed, 29 Jan 2014, Sebastian Capella wrote: > kstrimdup will duplicate and trim spaces from the passed in > null terminated string. This is useful for strings coming from > sysfs that often include trailing whitespace due to user input. > > Signed-off-by: Sebastian Capella > Cc: Andrew Mort

[PATCH v4 1/2] mm: add kstrimdup function

2014-01-29 Thread Sebastian Capella
kstrimdup will duplicate and trim spaces from the passed in null terminated string. This is useful for strings coming from sysfs that often include trailing whitespace due to user input. Signed-off-by: Sebastian Capella Cc: Andrew Morton Cc: Rik van Riel (commit_signer:5/10=50%) Cc: Michel Les