Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix covery scan warnings for wqueue #12103

Merged
merged 2 commits into from
May 29, 2019
Merged

Conversation

julianoes
Copy link
Contributor

@julianoes julianoes commented May 29, 2019

This was my take at the coverity scan warnings:

** CID 341063: Uninitialized members (UNINIT_CTOR)
/src/include/containers/BlockingQueue.hpp: 49 in BlockingQueue<const px4::wq_config_t *, (unsigned long)1>::BlockingQueue()()


________________________________________________________________________________________________________
*** CID 341063: Uninitialized members (UNINIT_CTOR)
/src/include/containers/BlockingQueue.hpp: 49 in BlockingQueue<const px4::wq_config_t *, (unsigned long)1>::BlockingQueue()()
43 public:
44
45 BlockingQueue()
46 {
47 px4_sem_init(&_sem_head, 0, N);
48 px4_sem_init(&_sem_tail, 0, 0);
>>> CID 341063: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "_data" is not initialized in this constructor nor in any functions that it calls.
49 }
50
51 ~BlockingQueue()
52 {
53 px4_sem_destroy(&_sem_head);
54 px4_sem_destroy(&_sem_tail);

** CID 196765: Null pointer dereferences (REVERSE_INULL)
/src/platforms/common/px4_work_queue/test/wqueue_start.cpp: 67 in wqueue_test_main()


________________________________________________________________________________________________________
*** CID 196765: Null pointer dereferences (REVERSE_INULL)
/src/platforms/common/px4_work_queue/test/wqueue_start.cpp: 67 in wqueue_test_main()
61
62 daemon_task = px4_task_spawn_cmd("wqueue",
63 SCHED_DEFAULT,
64 SCHED_PRIORITY_MAX - 5,
65 2000,
66 PX4_MAIN,
>>> CID 196765: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "argv" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
67 (argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
68
69 return 0;
70 }
71
72 if (!strcmp(argv[1], "stop")) {

julianoes added 2 commits May 29, 2019 08:41
This was reported by coverity.
This was found by coverity.
@julianoes julianoes requested a review from dagar May 29, 2019 06:46
@dagar
Copy link
Member

dagar commented May 29, 2019

Thanks @julianoes

@dagar dagar merged commit b135503 into master May 29, 2019
@dagar dagar deleted the pr-fix-coverity-queue-warnings branch May 29, 2019 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants