mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 23:47:06 +00:00
include/linux/cpumask.h: fix double string traverse in cpumask_parse
cpumask_parse() finds first occurrence of either or strchr() and strlen(). We can do it better with a single call of strchrnul(). [[email protected]: remove unneeded cast] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yury Norov <[email protected]> Acked-by: Rasmus Villemoes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
4e7301e6df
commit
3713a4e1fd
@@ -633,8 +633,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len,
|
||||
*/
|
||||
static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
|
||||
{
|
||||
char *nl = strchr(buf, '\n');
|
||||
unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
|
||||
unsigned int len = strchrnul(buf, '\n') - buf;
|
||||
|
||||
return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user