[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] libxlutil: avoid almost-undefined behavior



commit 56d599351879eeb7d2212ebb788d87ddb26f9fca
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 27 17:08:14 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 27 17:08:14 2021 +0100

    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()")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libs/util/libxlu_pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/libs/util/libxlu_pci.c b/tools/libs/util/libxlu_pci.c
index ad88fee088..551d8e3aed 100644
--- a/tools/libs/util/libxlu_pci.c
+++ b/tools/libs/util/libxlu_pci.c
@@ -155,9 +155,10 @@ int xlu_pci_parse_spec_string(XLU_Config *cfg, 
libxl_device_pci *pci,
     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;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.