Re: pointless code in probe_kernel_read

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

 



Hi Mikulas,

On 11/11/2013 04:13 PM, Mikulas Patocka wrote:
> Hi Helge
> 
> I noted that you created this function in commit 
> db080f9c530f78dad661257885a1893506077068
> 
> long probe_kernel_read(void *dst, const void *src, size_t size)
> {
>         unsigned long addr = (unsigned long)src;
> 
>         if (size < 0 || addr < PAGE_SIZE)
>                 return -EFAULT;
> 
>         /* check for I/O space F_EXTEND(0xfff00000) access as well? */
> 
>         return __probe_kernel_read(dst, src, size);
> }
> 
> size_t is unsigned, so comparison size < 0 doesn't make sense. What 
> exactly did you mean by this test?

Of course you are right. The "size < 0" check is superfluous.
I noticed that too when the code went upstream, but I was not yet motivated
too much to remove it again - at least the compiler should optimize it out.

The second part (addr < PAGE_SIZE) is relevant though.

Helge
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux