X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-relayd%2Flive.c;h=428e61361cc3625df776f88f3af1979571738b6b;hb=b21ebd59d1b269a51314e5708137cd7f38392a2a;hp=6c3e94f273f55afeb60da5597a4293c452bdc015;hpb=e0077699b76df46411a6ec0426a31005b2407497;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 6c3e94f27..428e61361 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -735,7 +735,12 @@ int viewer_connect(struct relay_connection *conn) reply.major = htobe32(reply.major); reply.minor = htobe32(reply.minor); if (conn->type == RELAY_VIEWER_COMMAND) { - reply.viewer_session_id = htobe64(++last_relay_viewer_session_id); + /* + * Increment outside of htobe64 macro, because can be used more than once + * within the macro, and thus the operation may be undefined. + */ + last_relay_viewer_session_id++; + reply.viewer_session_id = htobe64(last_relay_viewer_session_id); } health_code_update(); @@ -808,14 +813,9 @@ int viewer_list_sessions(struct relay_connection *conn) } health_code_update(); - rcu_read_unlock(); ret = 0; - goto end; - end_unlock: rcu_read_unlock(); - -end: return ret; }