@@ -5384,10 +5384,9 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
53845384 void __user * ubuf = (void __user * )arg ;
53855385 struct binder_write_read bwr ;
53865386
5387- if (copy_from_user (& bwr , ubuf , sizeof (bwr ))) {
5388- ret = - EFAULT ;
5389- goto out ;
5390- }
5387+ if (copy_from_user (& bwr , ubuf , sizeof (bwr )))
5388+ return - EFAULT ;
5389+
53915390 binder_debug (BINDER_DEBUG_READ_WRITE ,
53925391 "%d:%d write %lld at %016llx, read %lld at %016llx\n" ,
53935392 proc -> pid , thread -> pid ,
@@ -5402,8 +5401,6 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
54025401 trace_binder_write_done (ret );
54035402 if (ret < 0 ) {
54045403 bwr .read_consumed = 0 ;
5405- if (copy_to_user (ubuf , & bwr , sizeof (bwr )))
5406- ret = - EFAULT ;
54075404 goto out ;
54085405 }
54095406 }
@@ -5417,22 +5414,17 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
54175414 if (!binder_worklist_empty_ilocked (& proc -> todo ))
54185415 binder_wakeup_proc_ilocked (proc );
54195416 binder_inner_proc_unlock (proc );
5420- if (ret < 0 ) {
5421- if (copy_to_user (ubuf , & bwr , sizeof (bwr )))
5422- ret = - EFAULT ;
5417+ if (ret < 0 )
54235418 goto out ;
5424- }
54255419 }
54265420 binder_debug (BINDER_DEBUG_READ_WRITE ,
54275421 "%d:%d wrote %lld of %lld, read return %lld of %lld\n" ,
54285422 proc -> pid , thread -> pid ,
54295423 (u64 )bwr .write_consumed , (u64 )bwr .write_size ,
54305424 (u64 )bwr .read_consumed , (u64 )bwr .read_size );
5431- if (copy_to_user (ubuf , & bwr , sizeof (bwr ))) {
5432- ret = - EFAULT ;
5433- goto out ;
5434- }
54355425out :
5426+ if (copy_to_user (ubuf , & bwr , sizeof (bwr )))
5427+ ret = - EFAULT ;
54365428 return ret ;
54375429}
54385430
0 commit comments