ranges: fix casting of invalid range lists
I recently changed this to not allocate a new range list if the original
type is the type of the casted range list.
The problem is that sometimes we have bogus range lists where the type
is unsigned char but the range is 0-u32max. This could be because there
is a bug in the smatch code. I fixed one of those earlier today. Or it
could be because it's hard/impossible sometimes to get the type right
when typeof() is used.
I've added a check to deal with those incorrect range lists which should
hide the problem.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>