Re: [PATCH v3 11/12] mm/gup_benchmark: support pin_user_pages() and related calls

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

 



On 2/3/20 1:55 PM, Kirill A. Shutemov wrote:
> On Mon, Feb 03, 2020 at 01:17:40PM -0800, John Hubbard wrote:
>> On 2/3/20 5:58 AM, Kirill A. Shutemov wrote:
>> ...
>>>> @@ -19,6 +21,48 @@ struct gup_benchmark {
>>>>  	__u64 expansion[10];	/* For future use */
>>>>  };
>>>>  
>>>> +static void put_back_pages(unsigned int cmd, struct page **pages,
>>>> +			   unsigned long nr_pages)
>>>> +{
>>>> +	int i;
>>>> +
>>>> +	switch (cmd) {
>>>> +	case GUP_FAST_BENCHMARK:
>>>> +	case GUP_LONGTERM_BENCHMARK:
>>>> +	case GUP_BENCHMARK:
>>>> +		for (i = 0; i < nr_pages; i++)
>>>
>>> 'i' is 'int' and 'nr_pages' is 'unsigned long'.
>>> There's space for trouble :P
>>>
>>
>> Yes, I've changed it to "unsigned int", thanks.
> 
> I'm confused. If nr_pages is more than UINT_MAX, this is endless loop.
> Hm?
> 

Oh, I've been afflicted with 64-bit tunnel vision. OK, make that 
"unsigned long" and "%ul". yikes. :)



thanks,
-- 
John Hubbard
NVIDIA



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux