Skip to contentSkip to conversation

libxlutil: avoid almost-undefined behavior

PATCH In review Jan Beulich 2 participants 2 messages Jan 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxlutil: avoid almost-undefined behavior

While only value computations of an object are disallowed in the presence of another unsequenced side effect, at least gcc 4.3 looks to extend this to taking the object's address. The resulting warning causes the build to fail, because of -Werror.

While there also correct an adjacent comment.

Fixes bdc0799fe26a ("libxlu: introduce xlu_pci_parse_spec_string()")
tools/libs/util/libxlu_pci.c +3 -2
@@ -155,9 +155,10 @@ int xlu_pci_parse_spec_string(XLU_Config
     if (!ret) {
         bdf_present = true;
 
-        /* Check whether 'vslot' if present */
+        /* Check whether 'vslot' is present */
         if (*ptr == '@') {
-            ret = parse_vslot(&pci->vdevfn, ++ptr, &ptr);
+            ++ptr;
+            ret = parse_vslot(&pci->vdevfn, ptr, &ptr);
             if (ret)
                 return ret;
         }
Reviewed-by on v1 1/1
#1 lore raw

Jan Beulich writes ("[PATCH] libxlutil: avoid almost-undefined behavior"):

Quoted 9 lines

While only value computations of an object are disallowed in the presence of another unsequenced side effect, at least gcc 4.3 looks to extend this to taking the object's address. The resulting warning causes the build to fail, because of -Werror.

While there also correct an adjacent comment.

Fixes bdc0799fe26a ("libxlu: introduce xlu_pci_parse_spec_string()")