Skip to contentSkip to conversation

batman-adv: make the TT CRC logic VLAN specific

B.A.T.M.A.N. Dan Carpenter 2 participants 3 messages Nov 30, 2016 – Dec 5, 2016

lore
Share & tools
lore
#0 lore raw

Hello Antonio Quartulli,

The patch 7ea7b4a14275: "batman-adv: make the TT CRC logic VLAN specific" from Jul 30, 2013, leads to the following static checker warning:

net/batman-adv/translation-table.c:3294 batadv_send_my_tt_response()
error: uninitialized symbol 'tt_change'.

net/batman-adv/translation-table.c
3282 if (!full_table) {
3283 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
3284
3285 tt_len = bat_priv->tt.last_changeset_len;
3286 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,

  3287                                                               &tvlv_tt_data,
  3288                                                               &tt_change,
  3289                                                               &tt_len);

3290 if (!tt_len)
3291 goto unlock;

This should probably be changed to:

			if (!tt_len || !tvlv_len)
				goto unlock;

There seems to be an assumption that "tt_len" is set to zero on the error path? That's another way to fix this, I suppose.

  3292  
  3293                  /* Copy the last orig_node's OGM buffer */
  3294                  memcpy(tt_change, bat_priv->tt.last_changeset,
  3295                         bat_priv->tt.last_changeset_len);
  3296                  spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
  3297          } else {

See also:

net/batman-adv/translation-table.c:3313 batadv_send_my_tt_response()
error: uninitialized symbol 'tt_change'.

regards,
dan carpenter

#1 lore raw
Quoted 5 lines · On Mittwoch, 30. November 2016 22:53:27 CET Dan Carpenter wrote:

Hello Antonio Quartulli,

The patch 7ea7b4a14275: "batman-adv: make the TT CRC logic VLAN specific" from Jul 30, 2013, leads to the following static checker warning:

[...]

Quoted 2 lines

net/batman-adv/translation-table.c:3313 batadv_send_my_tt_response()
error: uninitialized symbol 'tt_change'.

Thank you very much for your excellent report. Antonio seems to be busy at the moment but Simon already forwarded [1] your suggestion to David.

Small question - what static checker reported that? I would usually guess smatch when I see your name but at least it was not reproducible with the current smatch from http://repo.or.cz/w/smatch.git

Kind regards,
Sven

[1] https://patchwork.ozlabs.org/patch/702031/

#2 lore raw
Quoted 10 lines · Sven Eckelmann
Quoted 5 lines · On Mittwoch, 30. November 2016 22:53:27 CET Dan Carpenter wrote:

Hello Antonio Quartulli,

The patch 7ea7b4a14275: "batman-adv: make the TT CRC logic VLAN specific" from Jul 30, 2013, leads to the following static checker warning:

[...]

Quoted 2 lines

net/batman-adv/translation-table.c:3313 batadv_send_my_tt_response()
error: uninitialized symbol 'tt_change'.

Quoted 6 lines

Thank you very much for your excellent report. Antonio seems to be busy at the moment but Simon already forwarded [1] your suggestion to David.

Small question - what static checker reported that? I would usually guess smatch when I see your name but at least it was not reproducible with the current smatch from http://repo.or.cz/w/smatch.git

It's some unreleased Smatch stuff I'm working on. (Very buggy).

regards,
dan carpenter