diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-06-03 16:19:07 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-28 02:44:53 -0400 |
commit | 347c80f0fb9adbd5f3756bd8a612664492768808 (patch) | |
tree | eb5a95b473d056ed281eb9291861342e0c58efb6 | |
parent | d4f4469255359c97564b15b5ef04253fd3ec08f1 (diff) |
batman-adv: Prefix local defines with BATADV_
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
-rw-r--r-- | net/batman-adv/bat_debugfs.c | 26 | ||||
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 114 | ||||
-rw-r--r-- | net/batman-adv/gateway_client.c | 12 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 16 |
4 files changed, 87 insertions, 81 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index ca6aee4bf941..ce84a616fddf 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -35,14 +35,14 @@ | |||
35 | static struct dentry *batadv_debugfs; | 35 | static struct dentry *batadv_debugfs; |
36 | 36 | ||
37 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 37 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
38 | #define LOG_BUFF_MASK (batadv_log_buff_len - 1) | 38 | #define BATADV_LOG_BUFF_MASK (batadv_log_buff_len - 1) |
39 | #define LOG_BUFF(idx) (debug_log->log_buff[(idx) & LOG_BUFF_MASK]) | 39 | #define BATADV_LOG_BUFF(idx) (debug_log->log_buff[(idx) & BATADV_LOG_BUFF_MASK]) |
40 | 40 | ||
41 | static int batadv_log_buff_len = LOG_BUF_LEN; | 41 | static int batadv_log_buff_len = LOG_BUF_LEN; |
42 | 42 | ||
43 | static void batadv_emit_log_char(struct debug_log *debug_log, char c) | 43 | static void batadv_emit_log_char(struct debug_log *debug_log, char c) |
44 | { | 44 | { |
45 | LOG_BUFF(debug_log->log_end) = c; | 45 | BATADV_LOG_BUFF(debug_log->log_end) = c; |
46 | debug_log->log_end++; | 46 | debug_log->log_end++; |
47 | 47 | ||
48 | if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) | 48 | if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) |
@@ -133,7 +133,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, | |||
133 | 133 | ||
134 | while ((!error) && (i < count) && | 134 | while ((!error) && (i < count) && |
135 | (debug_log->log_start != debug_log->log_end)) { | 135 | (debug_log->log_start != debug_log->log_end)) { |
136 | c = LOG_BUFF(debug_log->log_start); | 136 | c = BATADV_LOG_BUFF(debug_log->log_start); |
137 | 137 | ||
138 | debug_log->log_start++; | 138 | debug_log->log_start++; |
139 | 139 | ||
@@ -270,7 +270,7 @@ struct bat_debuginfo { | |||
270 | const struct file_operations fops; | 270 | const struct file_operations fops; |
271 | }; | 271 | }; |
272 | 272 | ||
273 | #define BAT_DEBUGINFO(_name, _mode, _open) \ | 273 | #define BATADV_DEBUGINFO(_name, _mode, _open) \ |
274 | struct bat_debuginfo batadv_debuginfo_##_name = { \ | 274 | struct bat_debuginfo batadv_debuginfo_##_name = { \ |
275 | .attr = { .name = __stringify(_name), \ | 275 | .attr = { .name = __stringify(_name), \ |
276 | .mode = _mode, }, \ | 276 | .mode = _mode, }, \ |
@@ -282,15 +282,17 @@ struct bat_debuginfo batadv_debuginfo_##_name = { \ | |||
282 | } \ | 282 | } \ |
283 | }; | 283 | }; |
284 | 284 | ||
285 | static BAT_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open); | 285 | static BATADV_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open); |
286 | static BAT_DEBUGINFO(originators, S_IRUGO, batadv_originators_open); | 286 | static BATADV_DEBUGINFO(originators, S_IRUGO, batadv_originators_open); |
287 | static BAT_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open); | 287 | static BATADV_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open); |
288 | static BAT_DEBUGINFO(transtable_global, S_IRUGO, batadv_transtable_global_open); | 288 | static BATADV_DEBUGINFO(transtable_global, S_IRUGO, |
289 | batadv_transtable_global_open); | ||
289 | #ifdef CONFIG_BATMAN_ADV_BLA | 290 | #ifdef CONFIG_BATMAN_ADV_BLA |
290 | static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open); | 291 | static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open); |
291 | #endif | 292 | #endif |
292 | static BAT_DEBUGINFO(transtable_local, S_IRUGO, batadv_transtable_local_open); | 293 | static BATADV_DEBUGINFO(transtable_local, S_IRUGO, |
293 | static BAT_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open); | 294 | batadv_transtable_local_open); |
295 | static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open); | ||
294 | 296 | ||
295 | static struct bat_debuginfo *batadv_mesh_debuginfos[] = { | 297 | static struct bat_debuginfo *batadv_mesh_debuginfos[] = { |
296 | &batadv_debuginfo_originators, | 298 | &batadv_debuginfo_originators, |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 54429a222bd6..3862fe18a033 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -38,9 +38,9 @@ static struct bat_priv *batadv_kobj_to_batpriv(struct kobject *obj) | |||
38 | return netdev_priv(net_dev); | 38 | return netdev_priv(net_dev); |
39 | } | 39 | } |
40 | 40 | ||
41 | #define UEV_TYPE_VAR "BATTYPE=" | 41 | #define BATADV_UEV_TYPE_VAR "BATTYPE=" |
42 | #define UEV_ACTION_VAR "BATACTION=" | 42 | #define BATADV_UEV_ACTION_VAR "BATACTION=" |
43 | #define UEV_DATA_VAR "BATDATA=" | 43 | #define BATADV_UEV_DATA_VAR "BATDATA=" |
44 | 44 | ||
45 | static char *batadv_uev_action_str[] = { | 45 | static char *batadv_uev_action_str[] = { |
46 | "add", | 46 | "add", |
@@ -53,15 +53,15 @@ static char *batadv_uev_type_str[] = { | |||
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* Use this, if you have customized show and store functions */ | 55 | /* Use this, if you have customized show and store functions */ |
56 | #define BAT_ATTR(_name, _mode, _show, _store) \ | 56 | #define BATADV_ATTR(_name, _mode, _show, _store) \ |
57 | struct bat_attribute batadv_attr_##_name = { \ | 57 | struct bat_attribute batadv_attr_##_name = { \ |
58 | .attr = {.name = __stringify(_name), \ | 58 | .attr = {.name = __stringify(_name), \ |
59 | .mode = _mode }, \ | 59 | .mode = _mode }, \ |
60 | .show = _show, \ | 60 | .show = _show, \ |
61 | .store = _store, \ | 61 | .store = _store, \ |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #define BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ | 64 | #define BATADV_ATTR_SIF_STORE_BOOL(_name, _post_func) \ |
65 | ssize_t batadv_store_##_name(struct kobject *kobj, \ | 65 | ssize_t batadv_store_##_name(struct kobject *kobj, \ |
66 | struct attribute *attr, char *buff, \ | 66 | struct attribute *attr, char *buff, \ |
67 | size_t count) \ | 67 | size_t count) \ |
@@ -72,7 +72,7 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ | |||
72 | &bat_priv->_name, net_dev); \ | 72 | &bat_priv->_name, net_dev); \ |
73 | } | 73 | } |
74 | 74 | ||
75 | #define BAT_ATTR_SIF_SHOW_BOOL(_name) \ | 75 | #define BATADV_ATTR_SIF_SHOW_BOOL(_name) \ |
76 | ssize_t batadv_show_##_name(struct kobject *kobj, \ | 76 | ssize_t batadv_show_##_name(struct kobject *kobj, \ |
77 | struct attribute *attr, char *buff) \ | 77 | struct attribute *attr, char *buff) \ |
78 | { \ | 78 | { \ |
@@ -85,14 +85,14 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ | |||
85 | /* Use this, if you are going to turn a [name] in the soft-interface | 85 | /* Use this, if you are going to turn a [name] in the soft-interface |
86 | * (bat_priv) on or off | 86 | * (bat_priv) on or off |
87 | */ | 87 | */ |
88 | #define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \ | 88 | #define BATADV_ATTR_SIF_BOOL(_name, _mode, _post_func) \ |
89 | static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ | 89 | static BATADV_ATTR_SIF_STORE_BOOL(_name, _post_func) \ |
90 | static BAT_ATTR_SIF_SHOW_BOOL(_name) \ | 90 | static BATADV_ATTR_SIF_SHOW_BOOL(_name) \ |
91 | static BAT_ATTR(_name, _mode, batadv_show_##_name, \ | 91 | static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ |
92 | batadv_store_##_name) | 92 | batadv_store_##_name) |
93 | 93 | ||
94 | 94 | ||
95 | #define BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ | 95 | #define BATADV_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ |
96 | ssize_t batadv_store_##_name(struct kobject *kobj, \ | 96 | ssize_t batadv_store_##_name(struct kobject *kobj, \ |
97 | struct attribute *attr, char *buff, \ | 97 | struct attribute *attr, char *buff, \ |
98 | size_t count) \ | 98 | size_t count) \ |
@@ -104,7 +104,7 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ | |||
104 | &bat_priv->_name, net_dev); \ | 104 | &bat_priv->_name, net_dev); \ |
105 | } | 105 | } |
106 | 106 | ||
107 | #define BAT_ATTR_SIF_SHOW_UINT(_name) \ | 107 | #define BATADV_ATTR_SIF_SHOW_UINT(_name) \ |
108 | ssize_t batadv_show_##_name(struct kobject *kobj, \ | 108 | ssize_t batadv_show_##_name(struct kobject *kobj, \ |
109 | struct attribute *attr, char *buff) \ | 109 | struct attribute *attr, char *buff) \ |
110 | { \ | 110 | { \ |
@@ -115,14 +115,14 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ | |||
115 | /* Use this, if you are going to set [name] in the soft-interface | 115 | /* Use this, if you are going to set [name] in the soft-interface |
116 | * (bat_priv) to an unsigned integer value | 116 | * (bat_priv) to an unsigned integer value |
117 | */ | 117 | */ |
118 | #define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ | 118 | #define BATADV_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ |
119 | static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ | 119 | static BATADV_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func)\ |
120 | static BAT_ATTR_SIF_SHOW_UINT(_name) \ | 120 | static BATADV_ATTR_SIF_SHOW_UINT(_name) \ |
121 | static BAT_ATTR(_name, _mode, batadv_show_##_name, \ | 121 | static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ |
122 | batadv_store_##_name) | 122 | batadv_store_##_name) |
123 | 123 | ||
124 | 124 | ||
125 | #define BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ | 125 | #define BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ |
126 | ssize_t batadv_store_##_name(struct kobject *kobj, \ | 126 | ssize_t batadv_store_##_name(struct kobject *kobj, \ |
127 | struct attribute *attr, char *buff, \ | 127 | struct attribute *attr, char *buff, \ |
128 | size_t count) \ | 128 | size_t count) \ |
@@ -143,7 +143,7 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ | |||
143 | return length; \ | 143 | return length; \ |
144 | } | 144 | } |
145 | 145 | ||
146 | #define BAT_ATTR_HIF_SHOW_UINT(_name) \ | 146 | #define BATADV_ATTR_HIF_SHOW_UINT(_name) \ |
147 | ssize_t batadv_show_##_name(struct kobject *kobj, \ | 147 | ssize_t batadv_show_##_name(struct kobject *kobj, \ |
148 | struct attribute *attr, char *buff) \ | 148 | struct attribute *attr, char *buff) \ |
149 | { \ | 149 | { \ |
@@ -164,11 +164,11 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ | |||
164 | /* Use this, if you are going to set [name] in hard_iface to an | 164 | /* Use this, if you are going to set [name] in hard_iface to an |
165 | * unsigned integer value | 165 | * unsigned integer value |
166 | */ | 166 | */ |
167 | #define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ | 167 | #define BATADV_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ |
168 | static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ | 168 | static BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func)\ |
169 | static BAT_ATTR_HIF_SHOW_UINT(_name) \ | 169 | static BATADV_ATTR_HIF_SHOW_UINT(_name) \ |
170 | static BAT_ATTR(_name, _mode, batadv_show_##_name, \ | 170 | static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ |
171 | batadv_store_##_name) | 171 | batadv_store_##_name) |
172 | 172 | ||
173 | 173 | ||
174 | static int batadv_store_bool_attr(char *buff, size_t count, | 174 | static int batadv_store_bool_attr(char *buff, size_t count, |
@@ -454,26 +454,27 @@ static ssize_t batadv_store_gw_bwidth(struct kobject *kobj, | |||
454 | return batadv_gw_bandwidth_set(net_dev, buff, count); | 454 | return batadv_gw_bandwidth_set(net_dev, buff, count); |
455 | } | 455 | } |
456 | 456 | ||
457 | BAT_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); | 457 | BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); |
458 | BAT_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); | 458 | BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); |
459 | #ifdef CONFIG_BATMAN_ADV_BLA | 459 | #ifdef CONFIG_BATMAN_ADV_BLA |
460 | BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); | 460 | BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); |
461 | #endif | 461 | #endif |
462 | BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu); | 462 | BATADV_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu); |
463 | BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); | 463 | BATADV_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); |
464 | static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, batadv_show_vis_mode, | 464 | static BATADV_ATTR(vis_mode, S_IRUGO | S_IWUSR, batadv_show_vis_mode, |
465 | batadv_store_vis_mode); | 465 | batadv_store_vis_mode); |
466 | static BAT_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL); | 466 | static BATADV_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL); |
467 | static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode, | 467 | static BATADV_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode, |
468 | batadv_store_gw_mode); | 468 | batadv_store_gw_mode); |
469 | BAT_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL); | 469 | BATADV_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, |
470 | BAT_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL); | 470 | NULL); |
471 | BAT_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE, | 471 | BATADV_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL); |
472 | batadv_post_gw_deselect); | 472 | BATADV_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE, |
473 | static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, | 473 | batadv_post_gw_deselect); |
474 | batadv_store_gw_bwidth); | 474 | static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, |
475 | batadv_store_gw_bwidth); | ||
475 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 476 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
476 | BAT_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL); | 477 | BATADV_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL); |
477 | #endif | 478 | #endif |
478 | 479 | ||
479 | static struct bat_attribute *batadv_mesh_attrs[] = { | 480 | static struct bat_attribute *batadv_mesh_attrs[] = { |
@@ -656,9 +657,9 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj, | |||
656 | return length; | 657 | return length; |
657 | } | 658 | } |
658 | 659 | ||
659 | static BAT_ATTR(mesh_iface, S_IRUGO | S_IWUSR, | 660 | static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface, |
660 | batadv_show_mesh_iface, batadv_store_mesh_iface); | 661 | batadv_store_mesh_iface); |
661 | static BAT_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); | 662 | static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); |
662 | 663 | ||
663 | static struct bat_attribute *batadv_batman_attrs[] = { | 664 | static struct bat_attribute *batadv_batman_attrs[] = { |
664 | &batadv_attr_mesh_iface, | 665 | &batadv_attr_mesh_iface, |
@@ -720,31 +721,32 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type, | |||
720 | 721 | ||
721 | bat_kobj = &primary_if->soft_iface->dev.kobj; | 722 | bat_kobj = &primary_if->soft_iface->dev.kobj; |
722 | 723 | ||
723 | uevent_env[0] = kmalloc(strlen(UEV_TYPE_VAR) + | 724 | uevent_env[0] = kmalloc(strlen(BATADV_UEV_TYPE_VAR) + |
724 | strlen(batadv_uev_type_str[type]) + 1, | 725 | strlen(batadv_uev_type_str[type]) + 1, |
725 | GFP_ATOMIC); | 726 | GFP_ATOMIC); |
726 | if (!uevent_env[0]) | 727 | if (!uevent_env[0]) |
727 | goto out; | 728 | goto out; |
728 | 729 | ||
729 | sprintf(uevent_env[0], "%s%s", UEV_TYPE_VAR, batadv_uev_type_str[type]); | 730 | sprintf(uevent_env[0], "%s%s", BATADV_UEV_TYPE_VAR, |
731 | batadv_uev_type_str[type]); | ||
730 | 732 | ||
731 | uevent_env[1] = kmalloc(strlen(UEV_ACTION_VAR) + | 733 | uevent_env[1] = kmalloc(strlen(BATADV_UEV_ACTION_VAR) + |
732 | strlen(batadv_uev_action_str[action]) + 1, | 734 | strlen(batadv_uev_action_str[action]) + 1, |
733 | GFP_ATOMIC); | 735 | GFP_ATOMIC); |
734 | if (!uevent_env[1]) | 736 | if (!uevent_env[1]) |
735 | goto out; | 737 | goto out; |
736 | 738 | ||
737 | sprintf(uevent_env[1], "%s%s", UEV_ACTION_VAR, | 739 | sprintf(uevent_env[1], "%s%s", BATADV_UEV_ACTION_VAR, |
738 | batadv_uev_action_str[action]); | 740 | batadv_uev_action_str[action]); |
739 | 741 | ||
740 | /* If the event is DEL, ignore the data field */ | 742 | /* If the event is DEL, ignore the data field */ |
741 | if (action != UEV_DEL) { | 743 | if (action != UEV_DEL) { |
742 | uevent_env[2] = kmalloc(strlen(UEV_DATA_VAR) + | 744 | uevent_env[2] = kmalloc(strlen(BATADV_UEV_DATA_VAR) + |
743 | strlen(data) + 1, GFP_ATOMIC); | 745 | strlen(data) + 1, GFP_ATOMIC); |
744 | if (!uevent_env[2]) | 746 | if (!uevent_env[2]) |
745 | goto out; | 747 | goto out; |
746 | 748 | ||
747 | sprintf(uevent_env[2], "%s%s", UEV_DATA_VAR, data); | 749 | sprintf(uevent_env[2], "%s%s", BATADV_UEV_DATA_VAR, data); |
748 | } | 750 | } |
749 | 751 | ||
750 | ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); | 752 | ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index f43eb57b8a69..3916e90ff6ed 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -33,8 +33,8 @@ | |||
33 | /* This is the offset of the options field in a dhcp packet starting at | 33 | /* This is the offset of the options field in a dhcp packet starting at |
34 | * the beginning of the dhcp header | 34 | * the beginning of the dhcp header |
35 | */ | 35 | */ |
36 | #define DHCP_OPTIONS_OFFSET 240 | 36 | #define BATADV_DHCP_OPTIONS_OFFSET 240 |
37 | #define DHCP_REQUEST 3 | 37 | #define BATADV_DHCP_REQUEST 3 |
38 | 38 | ||
39 | static void batadv_gw_node_free_ref(struct gw_node *gw_node) | 39 | static void batadv_gw_node_free_ref(struct gw_node *gw_node) |
40 | { | 40 | { |
@@ -521,11 +521,11 @@ static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) | |||
521 | 521 | ||
522 | pkt_len = skb_headlen(skb); | 522 | pkt_len = skb_headlen(skb); |
523 | 523 | ||
524 | if (pkt_len < header_len + DHCP_OPTIONS_OFFSET + 1) | 524 | if (pkt_len < header_len + BATADV_DHCP_OPTIONS_OFFSET + 1) |
525 | goto out; | 525 | goto out; |
526 | 526 | ||
527 | p = skb->data + header_len + DHCP_OPTIONS_OFFSET; | 527 | p = skb->data + header_len + BATADV_DHCP_OPTIONS_OFFSET; |
528 | pkt_len -= header_len + DHCP_OPTIONS_OFFSET + 1; | 528 | pkt_len -= header_len + BATADV_DHCP_OPTIONS_OFFSET + 1; |
529 | 529 | ||
530 | /* Access the dhcp option lists. Each entry is made up by: | 530 | /* Access the dhcp option lists. Each entry is made up by: |
531 | * - octet 1: option type | 531 | * - octet 1: option type |
@@ -543,7 +543,7 @@ static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) | |||
543 | p += 2; | 543 | p += 2; |
544 | 544 | ||
545 | /* check if the message type is what we need */ | 545 | /* check if the message type is what we need */ |
546 | if (*p == DHCP_REQUEST) | 546 | if (*p == BATADV_DHCP_REQUEST) |
547 | ret = true; | 547 | ret = true; |
548 | break; | 548 | break; |
549 | } else if (*p == 0) { | 549 | } else if (*p == 0) { |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 3095c41a67ad..7dc750670c34 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "hash.h" | 26 | #include "hash.h" |
27 | #include "originator.h" | 27 | #include "originator.h" |
28 | 28 | ||
29 | #define MAX_VIS_PACKET_SIZE 1000 | 29 | #define BATADV_MAX_VIS_PACKET_SIZE 1000 |
30 | 30 | ||
31 | static void batadv_start_vis_timer(struct bat_priv *bat_priv); | 31 | static void batadv_start_vis_timer(struct bat_priv *bat_priv); |
32 | 32 | ||
@@ -544,10 +544,12 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv, | |||
544 | static bool batadv_vis_packet_full(const struct vis_info *info) | 544 | static bool batadv_vis_packet_full(const struct vis_info *info) |
545 | { | 545 | { |
546 | const struct vis_packet *packet; | 546 | const struct vis_packet *packet; |
547 | size_t num_items; | ||
548 | |||
547 | packet = (struct vis_packet *)info->skb_packet->data; | 549 | packet = (struct vis_packet *)info->skb_packet->data; |
550 | num_items = BATADV_MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry); | ||
548 | 551 | ||
549 | if (MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry) | 552 | if (num_items < packet->entries + 1) |
550 | < packet->entries + 1) | ||
551 | return true; | 553 | return true; |
552 | return false; | 554 | return false; |
553 | } | 555 | } |
@@ -838,6 +840,7 @@ int batadv_vis_init(struct bat_priv *bat_priv) | |||
838 | { | 840 | { |
839 | struct vis_packet *packet; | 841 | struct vis_packet *packet; |
840 | int hash_added; | 842 | int hash_added; |
843 | unsigned int len; | ||
841 | 844 | ||
842 | if (bat_priv->vis_hash) | 845 | if (bat_priv->vis_hash) |
843 | return 0; | 846 | return 0; |
@@ -850,13 +853,12 @@ int batadv_vis_init(struct bat_priv *bat_priv) | |||
850 | goto err; | 853 | goto err; |
851 | } | 854 | } |
852 | 855 | ||
853 | bat_priv->my_vis_info = kmalloc(MAX_VIS_PACKET_SIZE, GFP_ATOMIC); | 856 | bat_priv->my_vis_info = kmalloc(BATADV_MAX_VIS_PACKET_SIZE, GFP_ATOMIC); |
854 | if (!bat_priv->my_vis_info) | 857 | if (!bat_priv->my_vis_info) |
855 | goto err; | 858 | goto err; |
856 | 859 | ||
857 | bat_priv->my_vis_info->skb_packet = dev_alloc_skb(sizeof(*packet) + | 860 | len = sizeof(*packet) + BATADV_MAX_VIS_PACKET_SIZE + ETH_HLEN; |
858 | MAX_VIS_PACKET_SIZE + | 861 | bat_priv->my_vis_info->skb_packet = dev_alloc_skb(len); |
859 | ETH_HLEN); | ||
860 | if (!bat_priv->my_vis_info->skb_packet) | 862 | if (!bat_priv->my_vis_info->skb_packet) |
861 | goto free_info; | 863 | goto free_info; |
862 | 864 | ||