]> git.baikalelectronics.ru Git - kernel.git/commit
lsm_audit,selinux: pass IB device name by reference
authorOndrej Mosnacek <omosnace@redhat.com>
Wed, 12 May 2021 14:32:10 +0000 (16:32 +0200)
committerPaul Moore <paul@paul-moore.com>
Fri, 14 May 2021 20:38:19 +0000 (16:38 -0400)
commit10136dc89a1aef27e03b980cc5f500e8b946617a
treefb5bed2397fc5a90fdd06d6ae4c182b6b7f0afa1
parent85f83de53f2cf887d345e4c033735ecce984fe07
lsm_audit,selinux: pass IB device name by reference

While trying to address a Coverity warning that the dev_name string
might end up unterminated when strcpy'ing it in
selinux_ib_endport_manage_subnet(), I realized that it is possible (and
simpler) to just pass the dev_name pointer directly, rather than copying
the string to a buffer.

The ibendport variable goes out of scope at the end of the function
anyway, so the lifetime of the dev_name pointer will never be shorter
than that of ibendport, thus we can safely just pass the dev_name
pointer and be done with it.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
include/linux/lsm_audit.h
security/selinux/hooks.c