From: Sage Weil Date: Thu, 12 May 2011 21:18:42 +0000 (-0700) Subject: libceph: fix uninitialized value when no get_authorizer method is set X-Git-Tag: firefly_0821_release~7613^2~907^2~24 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e8f54ce169125a2e59330fac25ad3c9ac0ce22a5;p=firefly-linux-kernel-4.4.55.git libceph: fix uninitialized value when no get_authorizer method is set If there is no get_authorizer method we set the out_kvec to a bogus pointer. The length is also zero in that case, so it doesn't much matter, but it's better not to add the empty item in the first place. Signed-off-by: Sage Weil --- diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index b140dd3515de..ce326c806237 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -619,11 +619,12 @@ static int prepare_connect_authorizer(struct ceph_connection *con) con->out_connect.authorizer_protocol = cpu_to_le32(auth_protocol); con->out_connect.authorizer_len = cpu_to_le32(auth_len); - con->out_kvec[con->out_kvec_left].iov_base = auth_buf; - con->out_kvec[con->out_kvec_left].iov_len = auth_len; - con->out_kvec_left++; - con->out_kvec_bytes += auth_len; - + if (auth_len) { + con->out_kvec[con->out_kvec_left].iov_base = auth_buf; + con->out_kvec[con->out_kvec_left].iov_len = auth_len; + con->out_kvec_left++; + con->out_kvec_bytes += auth_len; + } return 0; }