tunnel: Fix uninitialized access
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 1 Feb 2016 09:56:18 +0000 (10:56 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 1 Feb 2016 10:09:57 +0000 (11:09 +0100)
Fix tb_dev uninitialized access by device_init_settings

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
tunnel.c

index aa670a3974def3f179c20df0d3bbb8355e21daac..524fd435e3d1f3178cc34cd1c45b81f62596c5d1 100644 (file)
--- a/tunnel.c
+++ b/tunnel.c
@@ -49,12 +49,11 @@ tunnel_reload(struct device *dev, struct blob_attr *attr)
        if (uci_blob_check_equal(dev->config, attr, cfg))
                return DEV_CONFIG_NO_CHANGE;
 
-       if (attr) {
-               memset(tb_dev, 0, sizeof(tb_dev));
+       memset(tb_dev, 0, sizeof(tb_dev));
 
+       if (attr)
                blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev,
                        blob_data(attr), blob_len(attr));
-       }
 
        device_init_settings(dev, tb_dev);