From: Chen Gang Date: Thu, 16 May 2013 23:13:04 +0000 (+0000) Subject: net: irda: using kzalloc() instead of kmalloc() to avoid strncpy() issue. X-Git-Tag: v3.10-rc3~18^2~29 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff0102ee104847023c36357e2b9f133f3f40d211;p=pandora-kernel.git net: irda: using kzalloc() instead of kmalloc() to avoid strncpy() issue. 'discovery->data.info' length is 22, NICKNAME_MAX_LEN is 21, so the strncpy() will always left the last byte of 'discovery->data.info' uninitialized. When 'text' length is longer than 21 (NICKNAME_MAX_LEN), if still left the last byte of 'discovery->data.info' uninitialized, the next strlen() will cause issue. Also 'discovery->data' is 'struct irda_device_info' which defined in "include/uapi/...", it may copy to user mode, so need whole initialized. All together, need use kzalloc() instead of kmalloc() to initialize all members firstly. Signed-off-by: Chen Gang Signed-off-by: David S. Miller --- Reading git-diff-tree failed