summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/legacy/server/src/server-protocol.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-02 04:55:28 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-02 05:17:03 -0700
commit2f15ffd6b5beef9abd501c594bc3cb38c2683f77 (patch)
tree107176560e1a97c42f3535380ef49d4dee3b0cd6 /xlators/protocol/legacy/server/src/server-protocol.c
parent3dc79ca8e6119f5ff61058cc87f9a4fc251017ef (diff)
NULL dereference fixes in code base after running with 'clang'
* 212 logical (NULL deref/divide by zero) errors reduced to 28 (27 of them in contrib/ and lex part of codebase, 1 is invalid) * 11 API errors reduced to 0 Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966
Diffstat (limited to 'xlators/protocol/legacy/server/src/server-protocol.c')
-rw-r--r--xlators/protocol/legacy/server/src/server-protocol.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/xlators/protocol/legacy/server/src/server-protocol.c b/xlators/protocol/legacy/server/src/server-protocol.c
index 6a48dff39..da0303019 100644
--- a/xlators/protocol/legacy/server/src/server-protocol.c
+++ b/xlators/protocol/legacy/server/src/server-protocol.c
@@ -147,7 +147,7 @@ server_print_params (char *str, int size, server_state_t *state)
"wbflags=%d,", state->wbflags);
if (state->size)
filled += snprintf (str + filled, size - filled,
- "size=%Zu,", state->size);
+ "size=%zu,", state->size);
if (state->offset)
filled += snprintf (str + filled, size - filled,
"offset=%"PRId64",", state->offset);
@@ -667,8 +667,8 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_errno = gf_errno_to_error (op_errno);
hdr->rsp.op_errno = hton32 (gf_errno);
+ state = CALL_STATE(frame);
if (op_ret >= 0) {
- state = CALL_STATE(frame);
if (state->cmd == ENTRYLK_UNLOCK)
gf_del_locker (conn->ltable, state->volume,
NULL, state->fd, frame->root->pid);
@@ -5656,7 +5656,7 @@ mop_setvolume (call_frame_t *frame, xlator_t *bound_xl,
fail:
dict_len = dict_serialized_length (reply);
if (dict_len < 0) {
- gf_log (xl->name, GF_LOG_DEBUG,
+ gf_log ("server", GF_LOG_DEBUG,
"failed to get serialized length of reply dict");
op_ret = -1;
op_errno = EINVAL;
@@ -5670,7 +5670,7 @@ fail:
if (dict_len) {
ret = dict_serialize (reply, rsp->buf);
if (ret < 0) {
- gf_log (xl->name, GF_LOG_DEBUG,
+ gf_log ("server", GF_LOG_DEBUG,
"failed to serialize reply dict");
op_ret = -1;
op_errno = -ret;
@@ -6524,15 +6524,19 @@ int
notify (xlator_t *this, int32_t event, void *data, ...)
{
int ret = 0;
- transport_t *trans = data;
+ transport_t *trans = NULL;
peer_info_t *peerinfo = NULL;
peer_info_t *myinfo = NULL;
- if (trans != NULL) {
- peerinfo = &(trans->peerinfo);
- myinfo = &(trans->myinfo);
+ trans = data;
+ if (!trans) {
+ gf_log (this->name, GF_LOG_ERROR, "!trans");
+ goto out;
}
+ peerinfo = &(trans->peerinfo);
+ myinfo = &(trans->myinfo);
+
switch (event) {
case GF_EVENT_POLLIN:
ret = protocol_server_pollin (this, trans);
@@ -6576,7 +6580,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
default_notify (this, event, data);
break;
}
-
+out:
return ret;
}
hex'> 78 e1 e2 97 4d e8 1f f0 54 c6 87 3e 8c c9 1e 5b 29 c7 56 92 b2 a6 5e 41 6e f2 1d be de 69 f8 f3 x...M...T..>...[).V...^An....i.. 0520 ef 13 8b fb 99 e4 f2 00 46 de d1 33 bf dd b1 ac 6c 98 0e ac cc f5 a3 af c2 ec 24 f0 59 5d 25 79 ........F..3....l.........$.Y]%y 0540 29 c2 23 d8 3c 8d 90 27 18 0b 94 c6 99 78 e6 9d 1e 61 03 af a7 11 34 bc 4d a4 84 37 71 06 8c 2c ).#.<..'.....x...a....4.M..7q.., 0560 0e 42 55 e7 45 48 67 5d c2 88 d6 9d 07 bd 0f 35 6e 15 34 6f e2 c3 b0 73 53 bb 61 98 07 8f ef 2e .BU.EHg].......5n.4o...sS.a..... 0580 1c 1a b2 e6 a5 04 b4 b5 e6 74 50 a7 51 92 ea ea e2 2e 7f 51 46 3e 05 03 cf 6a d3 07 09 73 34 fa .........tP.Q......QF>...j...s4. 05a0 26 9e 23 c1 1b 65 f6 f9 8a 47 05 3d 09 f9 1d c5 1c 7f df 7c f6 13 f1 d6 d8 01 5f 5f fe e8 fc 52 &.#..e...G.=.......|......__...R 05c0 f9 f0 34 e6 17 d7 04 3f ec 30 55 20 13 1e 73 fa 1e 0d 37 fc bb e1 7c 5f 01 93 1f da 40 d2 1e f3 ..4....?.0U...s...7...|_....@... 05e0 26 12 88 e4 67 6a c6 5d c2 69 cf 4f d3 9e aa a4 52 79 c8 d3 1e 26 c9 85 64 66 2a 49 e1 f7 1c f3 &...gj.].i.O....Ry...&..df*I.... 0600 ec f4 bc 71 bc 6d 9a 3f e1 ad 66 9f 56 7e 12 b2 3d de bc 93 ee e4 a2 ca d3 a4 ce b2 57 19 68 9d ...q.m.?..f.V~..=...........W.h. 0620 7e 09 36 ff 60 70 73 a7 ce 93 d4 ec 39 82 a2 80 2c 16 4a c1 e0 17 49 e5 e3 28 c2 ef ab ff 00 7e ~.6.`ps.....9...,.J...I..(.....~ 0640 f8 c8 16 65 6e 64 73 74 72 65 61 6d 0a 65 6e 64 6f 62 6a 0a 32 20 30 20 6f 62 6a 20 3c 3c 0a 2f ...endstream.endobj.2.0.obj.<<./ 0660 54 79 70 65 20 2f 50 61 67 65 0a 2f 43 6f 6e 74 65 6e 74 73 20 33 20 30 20 52 0a 2f 52 65 73 6f Type./Page./Contents.3.0.R./Reso 0680 75 72 63 65 73 20 31 20 30 20 52 0a 2f 4d 65 64 69 61 42 6f 78 20 5b 30 20 30 20 35 39 35 2e 32 urces.1.0.R./MediaBox.[0.0.595.2 06a0 37 35 36 20 38 34 31 2e 38 38 39 38 5d 0a 2f 50 61 72 65 6e 74 20 31 32 20 30 20 52 0a 3e 3e 20 756.841.8898]./Parent.12.0.R.>>. 06c0 65 6e 64 6f 62 6a 0a 31 20 30 20 6f 62 6a 20 3c 3c 0a 2f 46 6f 6e 74 20 3c 3c 20 2f 46 31 37 20 endobj.1.0.obj.<<./Font.<<./F17. 06e0 34 20 30 20 52 20 2f 46 31 38 20 35 20 30 20 52 20 2f 46 32 39 20 36 20 30 20 52 20 2f 46 33 30 4.0.R./F18.5.0.R./F29.6.0.R./F30 0700 20 37 20 30 20 52 20 2f 46 31 35 20 38 20 30 20 52 20 2f 46 33 31 20 39 20 30 20 52 20 2f 46 33 .7.0.R./F15.8.0.R./F31.9.0.R./F3 0720 32 20 31 30 20 30 20 52 20 2f 46 33 33 20 31 31 20 30 20 52 20 3e 3e 0a 2f 50 72 6f 63 53 65 74 2.10.0.R./F33.11.0.R.>>./ProcSet 0740 20 5b 20 2f 50 44 46 20 2f 54 65 78 74 20 5d 0a 3e 3e 20 65 6e 64 6f 62 6a 0a 31 35 20 30 20 6f .[./PDF./Text.].>>.endobj.15.0.o 0760 62 6a 20 3c 3c 0a 2f 4c 65 6e 67 74 68 20 31 34 39 33 20 20 20 20 20 20 0a 2f 46 69 6c 74 65 72 bj.<<./Length.1493......./Filter 0780 20 2f 46 6c 61 74 65 44 65 63 6f 64 65 0a 3e 3e 0a 73 74 72 65 61 6d 0a 78 da 8d 57 4b 8f db 36 ./FlateDecode.>>.stream.x..WK..6 07a0 10 be e7 57 f8 28 03 2b 45 14 f5 4c 4f 49 da a0 28 0a 14 08 7c cb f6 c0 95 e8 b5 60 59 32 44 29 ...W.(.+E..LOI..(...|......`Y2D) 07c0 1b ff fb ce 8b b2 9d 68 9b 1c 76 35 24 87 c3 79 7e 33 fe b0 7b f3 f6 93 56 9b 2a aa f2 24 df ec .......h..v5$..y~3..{...V.*..$.. 07e0 f6 1b a5 75 54 e4 65 ba 29 e2 22 52 49 a6 36 bb e6 4b f0 75 e8 e6 93 dd 86 59 92 05 4f 63 5b 1f ...uT.e.)."RI.6..K.u.....Y..Oc[. 0800 d5 f6 df dd 5f 9b 2c 4a 92 4a 6d 42 a5 a2 2a cb 12 62 9d 2e 67 61 dc 5b 33 cd a3 75 6f cf 83 db ...._.,J.JmB..*..b..ga.[3..uo... 0820 aa a0 fd 16 76 43 7d 74 74 33 f6 97 58 be 9b 9f f8 09 77 f7 86 0a c2 86 f9 c3 b5 a7 6c df 84 a2 ....vC}tt3..X.....w.........l... 0840 19 f0 80 21 f1 46 a5 91 4e f3 04 2d 81 27 74 19 55 aa 2a 89 f9 77 eb da e7 5e 18 d3 cd 22 87 18 ...!.F..N..-.'t.U.*..w...^...".. 0860 93 2a 2a ca b2 20 c6 cf d6 34 db 50 17 59 60 ba e7 61 6c a7 c3 89 6f a9 ec c6 4f 78 09 de ca 33 .**......4.P.Y`..al...o...Ox...3 0880 4d 97 de 77 1d de 51 c1 70 de 86 49 11 d8 d1 4c ed d0 3b de 9c 0e 66 62 aa 19 f0 1b 07 fd 20 1b M..w..Q.p..I...L..;...fb........ 08a0 27 d8 48 ca a0 69 f7 17 e1 05 ab 0f db 50 05 96 39 1f 63 9d 76 56 84 8f 22 a5 1d 6d 3d 0d e3 85 '.H..i.......P..9.c.vV.."..m=... 08c0 59 cc 28 e7 ce f6 5b 10 26 a2 27 79 cb 78 dd a6 83 e7 9b 9f c2 fb 30 b0 43 bf e2 6d 1f 07 ad d3 Y.(...[.&.'y.x........0.C..m.... 08e0 c0 f4 e8 0a ad e5 2a 10 a8 ce e8 26 5e b8 b9 ae ad 73 fb b9 63 f6 d1 9e bb 0b 1f b5 8e bf a3 85 ......*....&^....s..c........... 0900 1c e8 ad 17 33 30 e3 22 ce 9c cf 5d 5b 93 af a2 45 a3 22 aa 74 c2 51 db 21 63 aa 14 c8 31 cd 63 ....30."...][...E.".t.Q.!c...1.c 0920 9c c5 f0 a7 70 27 0e dc c5 4d f6 c4 74 4d 36 22 1f f2 20 6f db 3f f3 51 63 26 c3 47 fb 71 10 76 ....p'...M..tM6"...o.?.Qc&.G.q.v 0940 e3 79 d1 b5 57 89 a8 33 ee 9b 9e d7 f6 5