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

[Xen-changelog] [xen master] tools/blktap2: Fix use of uninitialised variable in _tap_list_join3()



commit ca4c1848f128e3aeb8a79945137d6b2bc710ba93
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Apr 27 13:31:05 2016 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Apr 27 20:31:34 2016 +0100

    tools/blktap2: Fix use of uninitialised variable in _tap_list_join3()
    
    Clang points out:
    
      tap-ctl-list.c:457:28: error: variable 'entry' is uninitialized when
      used here [-Werror,-Wuninitialized]
              for (; *_entry != NULL; ++entry) {
                                        ^~~~~
    
    The content of that loop clearly was meant to iterate over _entry rather 
than
    entry, so is fixed to do so.  This presumably fixes a memory leak when
    tapdisks get orphed, as only the first item on the list got freed.
    
    There is no use of entry at all.  It is referenced in a
    list_for_each_entry(tl, &tap->list, entry) construct, but this is just a
    member name, and not a reference to local scope variable of the same name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
 tools/blktap2/control/tap-ctl-list.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/blktap2/control/tap-ctl-list.c 
b/tools/blktap2/control/tap-ctl-list.c
index c91f6f4..f8d49c3 100644
--- a/tools/blktap2/control/tap-ctl-list.c
+++ b/tools/blktap2/control/tap-ctl-list.c
@@ -400,7 +400,7 @@ int
 _tap_list_join3(int n_minors, int *minorv, int n_taps, struct tapdisk *tapv,
                tap_list_t ***_list)
 {
-       tap_list_t **list, **_entry, *entry;
+       tap_list_t **list, **_entry;
        int i, _m, err;
 
        list = tap_ctl_alloc_list(n_minors + n_taps);
@@ -454,7 +454,7 @@ _tap_list_join3(int n_minors, int *minorv, int n_taps, 
struct tapdisk *tapv,
        }
 
        /* free extraneous list entries */
-       for (; *_entry != NULL; ++entry) {
+       for (; *_entry != NULL; ++_entry) {
                free_list(*_entry);
                *_entry = NULL;
        }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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