[PATCH v2] lsm_audit,selinux: pass IB device name by reference

Paul Moore paul at paul-moore.com
Fri May 14 20:40:17 UTC 2021


On Wed, May 12, 2021 at 10:32 AM Ondrej Mosnacek <omosnace at redhat.com> wrote:
>
> 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 at redhat.com>
> ---
>  include/linux/lsm_audit.h | 8 ++++----
>  security/selinux/hooks.c  | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)

Much better, merged into selinux/next.  Thanks.

-- 
paul moore
www.paul-moore.com




More information about the Linux-audit mailing list