Fix: evaluation: dereference before NULL check in create_from_payload
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 23 Jun 2020 22:06:53 +0000 (18:06 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 4 Aug 2020 23:40:32 +0000 (19:40 -0400)
commit2f571d6fcdc6603de2b68eef27214c360a1dac5d
tree882b76db6bc18fca08c74e4184bd133d9fa6ed11
parent1f3d1fcc56f93f12f6ea7eb8ed4637ed1c5fb03b
Fix: evaluation: dereference before NULL check in create_from_payload

An evaluation payload view is created from the view passed to
lttng_evaluation_create_from_payload. Since a view contains a const
copy of the _fds array, it must be initialized as the declaration site.

However, src_view is checked for NULL after the initalization. Coverity
rightfully warns that:

  1429799 Dereference before null check

  There may be a null pointer dereference, or else the comparison against
  null is unnecessary.

  In lttng_evaluation_create_from_payload: All paths that lead to this
  null pointer comparison already dereference the pointer
  earlier (CWE-476)

This is not reachable right now, but it is fixed to silence the warning
and prevent future mistakes.

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3ceace4117ff54265b1f0cf6a4c638aec95f2879
src/common/evaluation.c
This page took 0.032787 seconds and 4 git commands to generate.