]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: drop unnecessary NULL check
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 17 Feb 2022 14:21:28 +0000 (15:21 +0100)
committerPaul Moore <paul@paul-moore.com>
Tue, 7 Jun 2022 21:20:10 +0000 (17:20 -0400)
commita3f70e5a4a6b312aa60cfc1fe55d3c813d5f0a00
tree421ef603a1a83df177f2e62b059b49ef1079f2ab
parent52d53094922676ab7bac49dee38e0ebe4e85a6f7
selinux: drop unnecessary NULL check

Commit 3e4e7bab49ac ("selinux: kill selinux_sb_get_mnt_opts()")
introduced a NULL check on the context after a successful call to
security_sid_to_context().  This is on the one hand redundant after
checking for success and on the other hand insufficient on an actual
NULL pointer, since the context is passed to seq_escape() leading to a
call of strlen() on it.

Reported by Clang analyzer:

    In file included from security/selinux/hooks.c:28:
    In file included from ./include/linux/tracehook.h:50:
    In file included from ./include/linux/memcontrol.h:13:
    In file included from ./include/linux/cgroup.h:18:
    ./include/linux/seq_file.h:136:25: warning: Null pointer passed as 1st argument to string length function [unix.cstring.NullArg]
            seq_escape_mem(m, src, strlen(src), flags, esc);
                                   ^~~~~~~~~~~

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c