Hi Dan, I agree that this is not obvious, but tipc_link_set_tolerance () can only be called on a unicast link, where l->bc_rcvlink always is set. If you try with the broadcast link a command to change tolerance makes no sense, and will be rejected. So in reality the added check is not even necessary, - I was just over-prudent when I wrote this patch.
///jon > -----Original Message----- > From: Dan Carpenter <[email protected]> > Sent: 1-Nov-18 03:25 > To: Jon Maloy <[email protected]> > Cc: [email protected] > Subject: [bug report] tipc: set link tolerance correctly in broadcast link > > Hello Jon Maloy, > > This is a semi-automatic email about new static checker warnings. > > The patch 047491ea334a: "tipc: set link tolerance correctly in broadcast link" > from Oct 10, 2018, leads to the following Smatch > complaint: > > net/tipc/link.c:2241 tipc_link_set_tolerance() > error: we previously assumed 'l->bc_rcvlink' could be null (see line > 2238) > > net/tipc/link.c > 2237 l->tolerance = tol; > 2238 if (l->bc_rcvlink) > ^^^^^^^^^^^^^ > We added a check here. > > 2239 l->bc_rcvlink->tolerance = tol; > 2240 if (link_is_up(l)) > 2241 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, > 0, tol, > 0, xmitq); > ^ But l->bc_rcvlink is > going to be dereferenced > inside this function without a check. Possibly the link_is_up() check > implies it > is non-NULL but I don't know the code well enough to say. > > 2242 } > 2243 > > regards, > dan carpenter _______________________________________________ tipc-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tipc-discussion
