Finding user/kernel pointer bugs [no html]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 10, 2004 at 12:10:04PM -0700, Greg KH wrote:
> @@ -170,8 +170,11 @@
>  static int DIV_TO_REG(int val)
>  {
>  	int answer = 0;
> -	while ((val >>= 1))
> +	val >>= 1;
> +	while (val) {
>  		answer++;
> +		val >>= 1;
> +	}
>  	return answer;

That's less readable than the original...

> -		data_ptrs = (u8 **) kmalloc(rdwr_arg.nmsgs * sizeof(u8 *),
> -					    GFP_KERNEL);
> +		data_ptrs = kmalloc(rdwr_arg.nmsgs * sizeof(u8 __user *), GFP_KERNEL);

While we are at it, what's the type of ->nmsgs?



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux