Summary: dtm: Fix cppcheck warnings [#1963] Review request for Trac Ticket(s): 1963 Peer Reviewer(s): Mahesh Pull request to: Affected branch(es): default(5.1) Development branch: default
-------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- changeset 6477e9169d3bf12024f15300edfcc82cd9114931 Author: Anders Widell <anders.wid...@ericsson.com> Date: Tue, 23 Aug 2016 11:59:08 +0200 dtm: Fix cppcheck warnings [#1963] The following warnings, reported by cppcheck version 1.75, have been fixed: [osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c:342]: (style) The scope of the variable 'buffer' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_intra.c:95]: (style) The scope of the variable 'servlen' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_intra.c:97]: (style) The scope of the variable 'server_ux_name' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_intra.c:155]: (style) Obsolescent function 'bzero' called. It is recommended to use 'memset' instead. [osaf/services/infrastructure/dtms/dtm/dtm_intra.c:207]: (error) Uninitialized variable: serveraddr [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:139]: (style) The scope of the variable 'del_ptr' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:243]: (style) The scope of the variable 'tmp' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:1836]: (style) The scope of the variable 'local_svc_node' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:710]: (style) Variable 'node_id' is assigned a value that is never used. [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:320]: (error) Memory leak: svc_node [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:512]: (error) Memory leak: subscr_node [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:516]: (error) Memory leak: subscr_info [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:1728]: (error) Memory leak: svc_info [osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c:1754]: (error) Memory leak: local_svc_info [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:54]: (style) Assignment of function parameter has no effect outside the function. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:74]: (style) The scope of the variable 'optlen' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:423]: (style) The scope of the variable 'err' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:617]: (style) The scope of the variable 'ip_addr_eth' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:720]: (style) The scope of the variable 'mcast_addr_eth' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:812]: (style) The scope of the variable 'mcast_addr_eth' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:1428]: (style) The scope of the variable 'numericAddress' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:1429]: (style) The scope of the variable 'addrBuffer' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:191]: (error) Uninitialized variable: join_request [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:192]: (error) Uninitialized variable: join_request [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:950]: (error) Uninitialized variable: addr_list [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:1014]: (error) Uninitialized variable: maddr [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:1015]: (error) Uninitialized variable: maddr [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:1144]: (error) Uninitialized variable: maddr [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:1145]: (error) Uninitialized variable: maddr [osaf/services/infrastructure/dtms/dtm/dtm_read_config.c:139]: (style) The scope of the variable 'tmp' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_read_config.c:140]: (style) The scope of the variable 'buf' can be reduced. [osaf/services/infrastructure/dtms/dtm/dtm_read_config.c:271]: (warning) fscanf() without field width limits can crash with huge input data. [osaf/services/infrastructure/dtms/dtm/dtm_read_config.c:327]: (error) Resource leak: dtm_conf_file [osaf/services/infrastructure/dtms/dtm/dtm_node.c:155]: (style) The function 'add_self_node' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_node.c:230]: (style) The function 'datagram_buff_dump' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:421]: (style) The function 'dtm_comm_socket_recv' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_node_db.c:252]: (style) The function 'dtm_node_get_by_node_ip' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_node_db.c:219]: (style) The function 'dtm_node_getnext_by_comm_socket' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_node_db.c:280]: (style) The function 'dtm_node_getnext_by_nodeaddr' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_main.c:403]: (style) The function 'dtms_cb_dump' is never used. [osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c:886]: (style) The function 'get_in_addr' is never used. Complete diffstat: ------------------ osaf/services/infrastructure/dtms/dtm/dtm_inter_svc.c | 5 +- osaf/services/infrastructure/dtms/dtm/dtm_intra.c | 10 ++-- osaf/services/infrastructure/dtms/dtm/dtm_intra_svc.c | 18 ++++++---- osaf/services/infrastructure/dtms/dtm/dtm_main.c | 18 ---------- osaf/services/infrastructure/dtms/dtm/dtm_node.c | 96 -------------------------------------------------------- osaf/services/infrastructure/dtms/dtm/dtm_node_db.c | 94 ------------------------------------------------------- osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c | 236 ++++++++----------------------------------------------------------------------------------------------------------------------------------- osaf/services/infrastructure/dtms/dtm/dtm_read_config.c | 41 ++++++++--------------- osaf/services/infrastructure/dtms/include/dtm.h | 3 - osaf/services/infrastructure/dtms/include/dtm_cb.h | 2 +- osaf/services/infrastructure/dtms/include/dtm_node.h | 2 - 11 files changed, 49 insertions(+), 476 deletions(-) Testing Commands: ----------------- make cppcheck Testing, Expected Results: -------------------------- No cppcheck warnings in the DTM service. Conditions of Submission: ------------------------- Ack from reviewer(s) Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: ------------------- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel