thermal: fix potential out-of-bounds memory access
authorGuenter Roeck <linux@roeck-us.net>
Sat, 21 Jul 2012 00:53:48 +0000 (10:53 +1000)
committerSimone Willett <swillett@nvidia.com>
Mon, 5 Nov 2012 18:10:31 +0000 (10:10 -0800)
commitf5230b96502ff75729034504beffb0a537d17c02
tree8ad37ffb5437988bb222e0ab8b07951bf4ecccf9
parentbcd76726363464fbcb35642a55a01c529bd74ec0
thermal: fix potential out-of-bounds memory access

temp_crit.name and temp_input.name have a length of 16 bytes.  Using
THERMAL_NAME_LENGTH (20) as length parameter for snprintf() may result in
out-of-bounds memory accesses.  Replace it with sizeof().

Addresses Coverity #115679

bug 1059470

Change-Id: I401dc97f4fcab8df87697ddf7ea1543c08e5827f
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: Len Brown <lenb@kernel.org>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-on: http://git-master/r/160236
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Joshua Primero <jprimero@nvidia.com>
Tested-by: Joshua Primero <jprimero@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
drivers/thermal/thermal_sys.c