From: Felix Fietkau Date: Mon, 6 Nov 2023 12:16:38 +0000 (+0100) Subject: device: fix build error on 32 bit systems X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=40ed7363caf2b22b6e29ed9d9948189c2bc4c8f3;p=project%2Fnetifd.git device: fix build error on 32 bit systems 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 --- diff --git a/bonding.c b/bonding.c index 402c71c..1f13148 100644 --- 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); diff --git a/bridge.c b/bridge.c index 63306c5..7a633ab 100644 --- 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; diff --git a/interface.c b/interface.c index 151dc9d..b2c1230 100644 --- a/interface.c +++ b/interface.c @@ -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