On 01.10.24 18:22, Marc-André Lureau wrote:
Hi Vladimir

On Tue, Oct 1, 2024 at 6:06 PM Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru 
<mailto:vsement...@yandex-team.ru>> wrote:

    On 30.09.24 11:14, marcandre.lur...@redhat.com 
<mailto:marcandre.lur...@redhat.com> wrote:
     > From: Marc-André Lureau <marcandre.lur...@redhat.com 
<mailto:marcandre.lur...@redhat.com>>
     >
     > object_resolve_path_type() didn't always set *ambiguousp.
     >
     > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com 
<mailto:marcandre.lur...@redhat.com>>
     > ---
     >   qom/object.c | 5 ++++-
     >   1 file changed, 4 insertions(+), 1 deletion(-)
     >
     > diff --git a/qom/object.c b/qom/object.c
     > index 28c5b66eab..bdc8a2c666 100644
     > --- a/qom/object.c
     > +++ b/qom/object.c
     > @@ -2201,6 +2201,9 @@ Object *object_resolve_path_type(const char *path, 
const char *typename,
     >           }
     >       } else {
     >           obj = object_resolve_abs_path(object_get_root(), parts + 1, 
typename);
     > +        if (ambiguousp) {
     > +            *ambiguousp = false;
     > +        }

    Doesn't this hunk in isolation fix the issue? With this 
object_resolve_path_type() should set the pointer on all paths if it is 
non-null..



    Hmm, called object_resolve_partial_path() also doesn't set ambiguous on 
every path, so this hunk is at lease incomplete.


yeah, but object_resolve_path_type() initializes it.

    I'm unsure about what semantics expected around ambigous pointers, but it seems to me 
that it is set only on failure paths, as a reason, why we failed. If this is true, I 
think, we need only the second hunk, which initializes local "ambig".


right, and that seems good enough.

Do you ack/rb this change then?


     qom/object: fix -Werror=maybe-uninitialized

     object_resolve_path_type() didn't always set *ambiguousp.

     Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com 
<mailto:marcandre.lur...@redhat.com>>

diff --git a/qom/object.c b/qom/object.c
index 28c5b66eab..d3d3003541 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2226,7 +2226,7 @@ Object *object_resolve_path_at(Object *parent, const char 
*path)

  Object *object_resolve_type_unambiguous(const char *typename, Error **errp)
  {
-    bool ambig;
+    bool ambig = false;
      Object *o = object_resolve_path_type("", typename, &ambig);

      if (ambig) {



Yes, I think this one in isolation is OK:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru>


thanks!

     >       }
     >
     >       g_strfreev(parts);
     > @@ -2226,7 +2229,7 @@ Object *object_resolve_path_at(Object *parent, 
const char *path)
     >
     >   Object *object_resolve_type_unambiguous(const char *typename, Error 
**errp)
     >   {
     > -    bool ambig;
     > +    bool ambig = false;
     >       Object *o = object_resolve_path_type("", typename, &ambig);
     >
     >       if (ambig) {

-- Best regards,
    Vladimir




--
Marc-André Lureau

--
Best regards,
Vladimir


Reply via email to