SELinux Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/9] Fix issues found by static analyzers
@ 2019-09-01 18:06 Nicolas Iooss
  2019-09-01 18:06 ` [PATCH 1/9] semodule-utils: fix comparison with argc Nicolas Iooss
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Nicolas Iooss @ 2019-09-01 18:06 UTC (permalink / raw)
  To: selinux

Hi,

In August I ran several free static analyzers in order to find new
issues in the userspace code. I used:

* clang's static analyzer (with scripts/run-scan-build)
* https://lgtm.com/ (I wrote a simple configuration file to analyze the
  C code, the results are available on
  https://lgtm.com/projects/g/fishilico/selinux-for-lgtm/ )
* Facebook's Infer (https://fbinfer.com/, I wrote a script to invoke it
  like clang's static analyzer)

Each analyzer gave many results, with several true bugs in them. Here
are patches that fix some of them. I will post the configuration files
and scripts I used separately.

Thanks,
Nicolas

Nicolas Iooss (9):
  semodule-utils: fix comparison with argc
  libsepol/cil: help static analyzers by aborting when an allocation
    fails
  libsepol: do not dereference a failed allocated pointer
  libsepol: do not dereference scope if it can be NULL
  libsepol: reset *p to NULL if sepol_module_package_create fails
  libsepol/cil: do not dereference perm_value_to_cil when it has not
    been allocated
  python/chcat: remove unnecessary assignment
  python/sepolicy: remove unnecessary pass statement
  libsepol/tests: do not dereference a NULL pointer

 libsepol/cil/src/cil_binary.c                        | 10 ++++++----
 libsepol/cil/src/cil_mem.c                           |  5 +++++
 libsepol/src/avrule_block.c                          |  3 ++-
 libsepol/src/kernel_to_cil.c                         |  8 +++++---
 libsepol/src/kernel_to_conf.c                        |  8 +++++---
 libsepol/src/module.c                                |  4 +++-
 libsepol/tests/test-common.c                         | 11 +++++++----
 python/chcat/chcat                                   |  1 -
 python/sepolicy/sepolicy/__init__.py                 |  1 -
 semodule-utils/semodule_package/semodule_unpackage.c |  2 +-
 10 files changed, 34 insertions(+), 19 deletions(-)

-- 
2.22.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, back to index

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01 18:06 [PATCH 0/9] Fix issues found by static analyzers Nicolas Iooss
2019-09-01 18:06 ` [PATCH 1/9] semodule-utils: fix comparison with argc Nicolas Iooss
2019-09-01 18:06 ` [PATCH 2/9] libsepol/cil: help static analyzers by aborting when an allocation fails Nicolas Iooss
2019-09-10 18:48   ` [Non-DoD Source] " jwcart2
2019-09-01 18:06 ` [PATCH 3/9] libsepol: do not dereference a failed allocated pointer Nicolas Iooss
2019-09-10 18:52   ` [Non-DoD Source] " jwcart2
2019-09-10 20:11     ` jwcart2
2019-09-01 18:06 ` [PATCH 4/9] libsepol: do not dereference scope if it can be NULL Nicolas Iooss
2019-09-01 18:06 ` [PATCH 5/9] libsepol: reset *p to NULL if sepol_module_package_create fails Nicolas Iooss
2019-09-01 18:06 ` [PATCH 6/9] libsepol/cil: do not dereference perm_value_to_cil when it has not been allocated Nicolas Iooss
2019-09-01 18:06 ` [PATCH 7/9] python/chcat: remove unnecessary assignment Nicolas Iooss
2019-09-01 18:06 ` [PATCH 8/9] python/sepolicy: remove unnecessary pass statement Nicolas Iooss
2019-09-01 18:06 ` [PATCH 9/9] libsepol/tests: do not dereference a NULL pointer Nicolas Iooss
2019-09-16 16:46 ` [Non-DoD Source] [PATCH 0/9] Fix issues found by static analyzers jwcart2
2019-09-17 15:01   ` jwcart2

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org
	public-inbox-index selinux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git