device: fix build error on 32 bit systems
authorFelix Fietkau <nbd@nbd.name>
Mon, 6 Nov 2023 12:16:38 +0000 (13:16 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 6 Nov 2023 12:16:39 +0000 (13:16 +0100)
Increase size of the diff fields for uci_blob_diff calls, since the device
attribute list increased to >32 entries

Signed-off-by: Felix Fietkau <nbd@nbd.name>
bonding.c
bridge.c
interface.c

index 402c71cb7a89a62eeda5fdde0a59014eaabcf233..1f13148fea41c929bb5dcf5db6771de722d6f072 100644 (file)
--- a/bonding.c
+++ b/bonding.c
@@ -442,10 +442,10 @@ bonding_reload(struct device *dev, struct blob_attr *attr)
        struct blob_attr *tb_dev[__DEV_ATTR_MAX];
        struct blob_attr *tb_b[__BOND_ATTR_MAX];
        enum dev_change_type ret = DEV_CONFIG_APPLIED;
-       unsigned long diff;
+       unsigned long diff[2] = {};
        struct bonding_device *bdev;
 
-       BUILD_BUG_ON(sizeof(diff) < __BOND_ATTR_MAX / 8);
+       BUILD_BUG_ON(sizeof(diff[0]) < __BOND_ATTR_MAX / 8);
        BUILD_BUG_ON(sizeof(diff) < __DEV_ATTR_MAX / 8);
 
        bdev = container_of(dev, struct bonding_device, dev);
@@ -472,17 +472,16 @@ bonding_reload(struct device *dev, struct blob_attr *attr)
                blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, otb_dev,
                        blob_data(bdev->config_data), blob_len(bdev->config_data));
 
-               diff = 0;
-               uci_blob_diff(tb_dev, otb_dev, &device_attr_list, &diff);
-               if (diff)
+               uci_blob_diff(tb_dev, otb_dev, &device_attr_list, diff);
+               if (diff[0] | diff[1])
                    ret = DEV_CONFIG_RESTART;
 
                blobmsg_parse(bonding_attrs, __BOND_ATTR_MAX, otb_b,
                        blob_data(bdev->config_data), blob_len(bdev->config_data));
 
-               diff = 0;
-               uci_blob_diff(tb_b, otb_b, &bonding_attr_list, &diff);
-               if (diff & ~(1 << BOND_ATTR_PORTS))
+               diff[0] = 0;
+               uci_blob_diff(tb_b, otb_b, &bonding_attr_list, diff);
+               if (diff[0] & ~(1 << BOND_ATTR_PORTS))
                    ret = DEV_CONFIG_RESTART;
 
                bonding_config_init(dev);
index 63306c5c7a9528bf10c96b3b8cb5a639740a70e2..7a633abe3f27965205033d0d01f9a9f567b77b4d 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -1252,7 +1252,7 @@ bridge_reload(struct device *dev, struct blob_attr *attr)
        struct blob_attr *tb_br[__BRIDGE_ATTR_MAX];
        enum dev_change_type ret = DEV_CONFIG_APPLIED;
        struct bridge_state *bst;
-       unsigned long diff[2];
+       unsigned long diff[2] = {};
 
        BUILD_BUG_ON(sizeof(diff) < __BRIDGE_ATTR_MAX / BITS_PER_LONG);
        BUILD_BUG_ON(sizeof(diff) < __DEV_ATTR_MAX / BITS_PER_LONG);
@@ -1279,7 +1279,6 @@ bridge_reload(struct device *dev, struct blob_attr *attr)
                blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, otb_dev,
                        blob_data(bst->config_data), blob_len(bst->config_data));
 
-               diff[0] = diff[1] = 0;
                uci_blob_diff(tb_dev, otb_dev, &device_attr_list, diff);
                if (diff[0] | diff[1]) {
                        ret = DEV_CONFIG_RESTART;
index 151dc9ddc3f7f401942f55b5765408bf7e1a3f1f..b2c12300106d9b7c347a5a7b8afc1bfdcd762be2 100644 (file)
@@ -1248,7 +1248,7 @@ interface_device_config_changed(struct interface *if_old, struct interface *if_n
        struct blob_attr *ntb[__DEV_ATTR_MAX];
        struct blob_attr *otb[__DEV_ATTR_MAX];
        struct device *dev = if_old->main_dev.dev;
-       unsigned long diff = 0;
+       unsigned long diff[2] = {};
 
        BUILD_BUG_ON(sizeof(diff) < __DEV_ATTR_MAX / 8);
 
@@ -1267,8 +1267,9 @@ interface_device_config_changed(struct interface *if_old, struct interface *if_n
        blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, ntb,
                blob_data(if_new->config), blob_len(if_new->config));
 
-       uci_blob_diff(ntb, otb, &device_attr_list, &diff);
-       return diff;
+       uci_blob_diff(ntb, otb, &device_attr_list, diff);
+
+       return diff[0] | diff[1];
 }
 
 static void