criu: lazy-pages: don't modify variable used in a loop

Submitted by Mike Rapoport on June 16, 2016, 9:02 a.m.

Details

Message ID 1466067720-32299-1-git-send-email-rppt@linux.vnet.ibm.com
State Accepted
Series "criu: lazy-pages: don't modify variable used in a loop"
Commit 8ab14263bbb77c230f5f1f92e797e9b3f3209808
Headers show

Commit Message

Mike Rapoport June 16, 2016, 9:02 a.m.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
 criu/uffd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/uffd.c b/criu/uffd.c
index 988e311..46d9be4 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -729,10 +729,11 @@  static int handle_requests(int epollfd, struct epoll_event *events)
 		}
 
 		for (i = 0; i < ret; i++) {
+			int err;
 			lpi = uffd_to_lpi(events[i].data.fd);
 			BUG_ON(!lpi);
-			ret = handle_user_fault(lpi, dest);
-			if (ret < 0)
+			err = handle_user_fault(lpi, dest);
+			if (err < 0)
 				goto out;
 		}
 	}

Comments

Pavel Emelianov June 16, 2016, 11:51 a.m.
On 06/16/2016 12:02 PM, Mike Rapoport wrote:
Applied
Andrey Vagin June 16, 2016, 3:02 p.m.
On Thu, Jun 16, 2016 at 12:02:00PM +0300, Mike Rapoport wrote:
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> ---
>  criu/uffd.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/uffd.c b/criu/uffd.c
> index 988e311..46d9be4 100644
> --- a/criu/uffd.c
> +++ b/criu/uffd.c
> @@ -729,10 +729,11 @@ static int handle_requests(int epollfd, struct epoll_event *events)
>  		}
>  
>  		for (i = 0; i < ret; i++) {
> +			int err;
>  			lpi = uffd_to_lpi(events[i].data.fd);
>  			BUG_ON(!lpi);
> -			ret = handle_user_fault(lpi, dest);
> -			if (ret < 0)
> +			err = handle_user_fault(lpi, dest);
> +			if (err < 0)
>  				goto out;

This function returns ret in this case. It is ok?
>  		}
>  	}
> -- 
> 1.9.1
>
Mike Rapoport June 16, 2016, 3:19 p.m.
On Thu, Jun 16, 2016 at 6:02 PM, Andrew Vagin <avagin@virtuozzo.com> wrote:
> On Thu, Jun 16, 2016 at 12:02:00PM +0300, Mike Rapoport wrote:
>> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
>> ---
>>  criu/uffd.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/criu/uffd.c b/criu/uffd.c
>> index 988e311..46d9be4 100644
>> --- a/criu/uffd.c
>> +++ b/criu/uffd.c
>> @@ -729,10 +729,11 @@ static int handle_requests(int epollfd, struct epoll_event *events)
>>               }
>>
>>               for (i = 0; i < ret; i++) {
>> +                     int err;
>>                       lpi = uffd_to_lpi(events[i].data.fd);
>>                       BUG_ON(!lpi);
>> -                     ret = handle_user_fault(lpi, dest);
>> -                     if (ret < 0)
>> +                     err = handle_user_fault(lpi, dest);
>> +                     if (err < 0)
>>                               goto out;
>
> This function returns ret in this case. It is ok?

Well, here ret != 0, so we'll exit(ret) which is fine :)

>>               }
>>       }
>> --
>> 1.9.1
>>