From: Alex Elder Date: Fri, 5 Oct 2012 00:13:16 +0000 (-0700) Subject: lib/parser.c: avoid overflow in match_number() X-Git-Tag: omap-for-v3.7-rc1/fixes-cpufreq-signed~12^2~115 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77dd3b0bd17a0849b2f98b915ce3fc9247db1013;p=pandora-kernel.git lib/parser.c: avoid overflow in match_number() The result of converting an integer value to another signed integer type that's unable to represent the original value is implementation defined. (See notes in section 6.3.1.3 of the C standard.) In match_number(), the result of simple_strtol() (which returns type long) is assigned to a value of type int. Instead, handle the result of simple_strtol() in a well-defined way, and return -ERANGE if the result won't fit in the int variable used to hold the parsed result. No current callers pay attention to the particular error value returned, so this additional return code shouldn't do any harm. [akpm@linux-foundation.org: coding-style tweaks] Signed-off-by: Alex Elder Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed