[PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()

Daniel Henrique Barboza posted 59 patches 6 years, 1 month ago
Maintainers: Aurelien Jarno <aurelien@aurel32.net>, Max Reitz <mreitz@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Greg Kurz <groug@kaod.org>, Jason Wang <jasowang@redhat.com>, Corey Minyard <minyard@acm.org>, Aleksandar Markovic <amarkovic@wavecomp.com>, Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, David Hildenbrand <david@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, "Daniel P. Berrangé" <berrange@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Wen Congyang <wencongyang2@huawei.com>, "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, "Richard W.M. Jones" <rjones@redhat.com>, Jeff Cody <codyprime@gmail.com>, Riku Voipio <riku.voipio@iki.fi>, Stefan Weil <sw@weilnetz.de>, Michael Roth <mdroth@linux.vnet.ibm.com>, Richard Henderson <rth@twiddle.net>, Eduardo Habkost <ehabkost@redhat.com>, Yuval Shaia <yuval.shaia.ml@gmail.com>, Fam Zheng <fam@euphon.net>, Xie Changlong <xiechanglong.d@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Halil Pasic <pasic@linux.ibm.com>, Juan Quintela <quintela@redhat.com>, John Snow <jsnow@redhat.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Christian Borntraeger <borntraeger@de.ibm.com>, Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, "Gonglei (Arei)" <arei.gonglei@huawei.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()
Posted by Daniel Henrique Barboza 6 years, 1 month ago
'err_out' can be removed and be replaced by 'return -errno'
in its only instance in the function.

CC: Greg Kurz <groug@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 fsdev/virtfs-proxy-helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 0d4de49dcf..aa1ab2590d 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -287,8 +287,7 @@ static int setugid(int uid, int gid, int *suid, int *sgid)
     *sgid = getegid();
 
     if (setresgid(-1, gid, *sgid) == -1) {
-        retval = -errno;
-        goto err_out;
+        return -errno;
     }
 
     if (setresuid(-1, uid, *suid) == -1) {
@@ -322,7 +321,6 @@ err_sgid:
     if (setresgid(-1, *sgid, *sgid) == -1) {
         abort();
     }
-err_out:
     return retval;
 }
 
-- 
2.24.1


Re: [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()
Posted by Greg Kurz 6 years, 1 month ago
On Mon,  6 Jan 2020 15:23:38 -0300
Daniel Henrique Barboza <danielhb413@gmail.com> wrote:

> 'err_out' can be removed and be replaced by 'return -errno'
> in its only instance in the function.
> 
> CC: Greg Kurz <groug@kaod.org>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---

I don't really mind, but I confirm this doesn't change behavior.

Acked-by: Greg Kurz <groug@kaod.org>

What's the plan to get this and the other 9p related patches merged ?
Through the trivial tree or each subsystem tree ?

>  fsdev/virtfs-proxy-helper.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
> index 0d4de49dcf..aa1ab2590d 100644
> --- a/fsdev/virtfs-proxy-helper.c
> +++ b/fsdev/virtfs-proxy-helper.c
> @@ -287,8 +287,7 @@ static int setugid(int uid, int gid, int *suid, int *sgid)
>      *sgid = getegid();
>  
>      if (setresgid(-1, gid, *sgid) == -1) {
> -        retval = -errno;
> -        goto err_out;
> +        return -errno;
>      }
>  
>      if (setresuid(-1, uid, *suid) == -1) {
> @@ -322,7 +321,6 @@ err_sgid:
>      if (setresgid(-1, *sgid, *sgid) == -1) {
>          abort();
>      }
> -err_out:
>      return retval;
>  }
>  


Re: [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()
Posted by Markus Armbruster 6 years ago
Greg Kurz <groug@kaod.org> writes:

> On Mon,  6 Jan 2020 15:23:38 -0300
> Daniel Henrique Barboza <danielhb413@gmail.com> wrote:
>
>> 'err_out' can be removed and be replaced by 'return -errno'
>> in its only instance in the function.
>> 
>> CC: Greg Kurz <groug@kaod.org>
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>> ---
>
> I don't really mind, but I confirm this doesn't change behavior.
>
> Acked-by: Greg Kurz <groug@kaod.org>
>
> What's the plan to get this and the other 9p related patches merged ?
> Through the trivial tree or each subsystem tree ?

I guess qemu-trivial will eventually pick up whatever hasn't been merged
by maintainers.

[...]


Re: [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()
Posted by Laurent Vivier 6 years ago
Le 13/01/2020 à 16:15, Markus Armbruster a écrit :
> Greg Kurz <groug@kaod.org> writes:
> 
>> On Mon,  6 Jan 2020 15:23:38 -0300
>> Daniel Henrique Barboza <danielhb413@gmail.com> wrote:
>>
>>> 'err_out' can be removed and be replaced by 'return -errno'
>>> in its only instance in the function.
>>>
>>> CC: Greg Kurz <groug@kaod.org>
>>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>>> ---
>>
>> I don't really mind, but I confirm this doesn't change behavior.
>>
>> Acked-by: Greg Kurz <groug@kaod.org>
>>
>> What's the plan to get this and the other 9p related patches merged ?
>> Through the trivial tree or each subsystem tree ?
> 
> I guess qemu-trivial will eventually pick up whatever hasn't been merged
> by maintainers.
> 
> [...]
> 

Yes, but the difficulty will be to sort which ones of the 59 patches
series to collect...

Thanks,
Laurent


Re: [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()
Posted by Markus Armbruster 6 years ago
Laurent Vivier <laurent@vivier.eu> writes:

> Le 13/01/2020 à 16:15, Markus Armbruster a écrit :
>> Greg Kurz <groug@kaod.org> writes:
>> 
>>> On Mon,  6 Jan 2020 15:23:38 -0300
>>> Daniel Henrique Barboza <danielhb413@gmail.com> wrote:
>>>
>>>> 'err_out' can be removed and be replaced by 'return -errno'
>>>> in its only instance in the function.
>>>>
>>>> CC: Greg Kurz <groug@kaod.org>
>>>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>>>> ---
>>>
>>> I don't really mind, but I confirm this doesn't change behavior.
>>>
>>> Acked-by: Greg Kurz <groug@kaod.org>
>>>
>>> What's the plan to get this and the other 9p related patches merged ?
>>> Through the trivial tree or each subsystem tree ?
>> 
>> I guess qemu-trivial will eventually pick up whatever hasn't been merged
>> by maintainers.
>> 
>> [...]
>> 
>
> Yes, but the difficulty will be to sort which ones of the 59 patches
> series to collect...

Collect them all and let git figure out which ones have been applied
already?


Re: [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid()
Posted by Greg Kurz 6 years ago
On Mon, 13 Jan 2020 17:32:31 +0100
Laurent Vivier <laurent@vivier.eu> wrote:

> Le 13/01/2020 à 16:15, Markus Armbruster a écrit :
> > Greg Kurz <groug@kaod.org> writes:
> > 
> >> On Mon,  6 Jan 2020 15:23:38 -0300
> >> Daniel Henrique Barboza <danielhb413@gmail.com> wrote:
> >>
> >>> 'err_out' can be removed and be replaced by 'return -errno'
> >>> in its only instance in the function.
> >>>
> >>> CC: Greg Kurz <groug@kaod.org>
> >>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> >>> ---
> >>
> >> I don't really mind, but I confirm this doesn't change behavior.
> >>
> >> Acked-by: Greg Kurz <groug@kaod.org>
> >>
> >> What's the plan to get this and the other 9p related patches merged ?
> >> Through the trivial tree or each subsystem tree ?
> > 
> > I guess qemu-trivial will eventually pick up whatever hasn't been merged
> > by maintainers.
> > 
> > [...]
> > 
> 
> Yes, but the difficulty will be to sort which ones of the 59 patches
> series to collect...
> 

Ok, less work for you then. I've applied both 12/59 and 45/59 to 9p-next.
I'm planning to send a PR later this week.

> Thanks,
> Laurent
> 

Cheers,

--
Greg