Ken Giusti created DISPATCH-2106:
------------------------------------

             Summary: [HTTP2] coverity errors
                 Key: DISPATCH-2106
                 URL: https://issues.apache.org/jira/browse/DISPATCH-2106
             Project: Qpid Dispatch
          Issue Type: Bug
          Components: Protocol Adaptors
    Affects Versions: 1.16.0
            Reporter: Ken Giusti
            Assignee: Ganesh Murthy
             Fix For: 1.17.0



[View in coverity 
website|https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yrYzWbMPmorD7XnOuZAY1PF5CxqEeKRARa-2FNIb9NgRx3I5GnaWT0ahntmzOiTsHYFJfTdXTXBeRPsUiGGEXnaDOWhxJ_w8xEUxas-2FGH82wkNPpeCiA-2Fca9GedKFqh2wBbuF5Hks63KpvdX8ua9OXCPRTdvgaN6wJ5z4C2sTXqY04L5a3RYdertN1-2FB9NA8Tq25x2C2-2FoQQRuU8G6vQ74tNg63oy771wTuBf5ZOuYWNDRy5qbjfRja-2BwLS4djseUaLyw5quDN7aSOVQvEqSp1q6Uu3Ga1HzY-2Bf7-2BNxQQEWi9jRLdrWg-3D-3D]

{{** CID 370602:  Control flow issues  (DEADCODE)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
1942 in qdr_http_deliver()


________________________________________________________________________________________________________
*** CID 370602:  Control flow issues  (DEADCODE)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
1942 in qdr_http_deliver()
1936             if (stream_data->status == QD_STREAM_FULLY_CLOSED && disp == 
PN_ACCEPTED) {
1937                 qd_log(http2_adaptor->log_source, QD_LOG_TRACE, 
"[C%"PRIu64"][S%"PRId32"] qdr_http_deliver - calling free_http2_stream_data", 
conn->conn_id, stream_data->stream_id);
1938                 free_http2_stream_data(stream_data, false);
1939             }
1940             return disp;
1941         }
>>>     CID 370602:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return 0UL;".
1942         return 0;
1943     }
1944     
1945     
1946     static int handle_incoming_http(qdr_http2_connection_t *conn)
1947     {

** CID 363441:  API usage errors  (PRINTF_ARGS)


________________________________________________________________________________________________________
*** CID 363441:  API usage errors  (PRINTF_ARGS)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
283 in write_buffers()
277             i ++;
278     
279         }
280     
281         if (i >0) {
282             size_t num_buffers_written = 
pn_raw_connection_write_buffers(session_data->conn->pn_raw_conn, raw_buffers, 
num_buffs);
>>>     CID 363441:  API usage errors  (PRINTF_ARGS)
>>>     Argument "num_buffers_written" to format specifier "%i" was expected to 
>>> have type "int" but has type "unsigned long".
283             qd_log(http2_adaptor->log_source, QD_LOG_TRACE, "[C%"PRIu64"] 
Written %i buffer(s) and %i bytes in write_buffers() using 
pn_raw_connection_write_buffers()", conn->conn_id, num_buffers_written, 
total_bytes);
284             if (num_buffs != num_buffers_written) {
285                 //TODO - This is not good.
286             }
287             return num_buffers_written;
288         }

** CID 363429:    (PRINTF_ARGS)


________________________________________________________________________________________________________
*** CID 363429:    (PRINTF_ARGS)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
2481 in handle_connection_event()
2475             if (written > 0 && !conn->ingress && !conn->first_pinged) {
2476                 // Send a PING frame 4 seconds after opening an egress 
connection.
2477                 qd_timer_schedule(conn->ping_timer, PING_INTERVAL * 1000);
2478                 conn->first_pinged = true;
2479             }
2480     
>>>     CID 363429:    (PRINTF_ARGS)
>>>     Argument "written" to format specifier "%i" was expected to have type 
>>> "int" but has type "unsigned long".
2481             qd_log(log, QD_LOG_TRACE, "[C%"PRIu64"] 
PN_RAW_CONNECTION_WRITTEN Wrote %i bytes, DEQ_SIZE(session_data->buffs) = %zu", 
conn->conn_id, written, DEQ_SIZE(conn->session_data->buffs));
2482             restart_streams(conn);
2483             break;
2484         }
2485         default:
2486             break;
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
2458 in handle_connection_event()
2452         }
2453         case PN_RAW_CONNECTION_WRITTEN: {
2454             pn_raw_buffer_t buffs[WRITE_BUFFERS];
2455             size_t n;
2456             size_t written = 0;
2457             if (conn->pn_raw_conn == 0) {
>>>     CID 363429:    (PRINTF_ARGS)
>>>     This argument was not used by the format string: "written".
2458                 qd_log(log, QD_LOG_TRACE, "[C%"PRIu64"] 
PN_RAW_CONNECTION_WRITTEN, No pn_raw_conn", conn->conn_id, written);
2459                 break;
2460             }
2461             while ( (n = 
pn_raw_connection_take_written_buffers(conn->pn_raw_conn, buffs, 
WRITE_BUFFERS)) ) {
2462                 for (size_t i = 0; i < n; ++i) {
2463                     written += buffs[i].size;

** CID 363423:  API usage errors  (PRINTF_ARGS)


________________________________________________________________________________________________________
*** CID 363423:  API usage errors  (PRINTF_ARGS)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
560 in snd_data_callback()
554                 if (pn_raw_buffs[idx].size > 0) {
555                     //int bytes_remaining = length - bytes_sent;
556                     //if (bytes_remaining > pn_raw_buffs[idx].size) {
557                         memcpy(qd_http2_buffer_cursor(http2_buff), 
pn_raw_buffs[idx].bytes, pn_raw_buffs[idx].size);
558                         qd_http2_buffer_insert(http2_buff, 
pn_raw_buffs[idx].size);
559                         bytes_sent += pn_raw_buffs[idx].size;
>>>     CID 363423:  API usage errors  (PRINTF_ARGS)
>>>     Argument "pn_raw_buffs[idx].size" to format specifier "%zu" was 
>>> expected to have type "size_t"("unsigned long") but has type "unsigned int".
560                         qd_log(http2_adaptor->protocol_log_source, 
QD_LOG_TRACE, "[C%"PRIu64"][S%"PRId32"] snd_data_callback memcpy 
pn_raw_buffs[%i].size=%zu", conn->conn_id, stream_data->stream_id, idx, 
pn_raw_buffs[idx].size);
561     //                }
562     //                else {
563     //                    memcpy(qd_http2_buffer_cursor(http2_buff), 
pn_raw_buffs[idx].bytes, bytes_remaining);
564     //                    qd_http2_buffer_insert(http2_buff, 
bytes_remaining);
565     //                    bytes_sent += bytes_remaining;

** CID 363400:  Error handling issues  (CHECKED_RETURN)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
2396 in handle_connection_event()


________________________________________________________________________________________________________
*** CID 363400:  Error handling issues  (CHECKED_RETURN)
/home/kgiusti/work/dispatch/qpid-dispatch/src/adaptors/http2/http2_adaptor.c: 
2396 in handle_connection_event()
2390                     conn->client_magic_sent = true;
2391                 }
2392                 qd_log(log, QD_LOG_INFO, "[C%"PRIu64"] Connected Egress 
(PN_RAW_CONNECTION_CONNECTED)", conn->conn_id);
2393                 conn->connection_established = true;
2394                 create_stream_dispatcher_link(conn);
2395                 qd_log(log, QD_LOG_TRACE, "[C%"PRIu64"] Created 
stream_dispatcher_link in PN_RAW_CONNECTION_CONNECTED", conn->conn_id);
>>>     CID 363400:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "qdr_connection_process" without checking return value (as is 
>>> done elsewhere 13 out of 15 times).
2396                 qdr_connection_process(conn->qdr_conn);
2397             }
2398             break;
2399         }
2400         case PN_RAW_CONNECTION_CLOSED_READ: {
2401             pn_raw_connection_close(conn->pn_raw_conn);


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, 
https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yrYzWbMPmorD7XnOuZAY1PF5CxqEeKRARa-2FNIb9NgRx3I5GnaWT0ahntmzOiTsHYFJfTdXTXBeRPsUiGGEXnaDOWhxJ_w8xEUxas-2FGH82wkNPpeCiA-2Fca9GedKFqh2wBbuF5Hks63KpvdX8ua9OXCPRTdvgaN6wJ5z4C2sTXqY04L5a3RYdertN1-2FB9NA8Tq25x2C2-2FoQQRuU8G6vQ74tNg63oy771wTuBf5ZOuYWNDRy5qbjfRja-2BwLS4djseUaLyw5quDN7aSOVQvEqSp1q6Uu3Ga1HzY-2Bf7-2BNxQQEWi9jRLdrWg-3D-3D
}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to