selinux: improve error checking in sel_write_load()
authorPaul Moore <paul@paul-moore.com>
Tue, 5 Mar 2024 03:12:22 +0000 (22:12 -0500)
committerPaul Moore <paul@paul-moore.com>
Tue, 26 Mar 2024 20:42:09 +0000 (16:42 -0400)
commit42c773238037c90b3302bf37a57ae3b5c3f6004a
treea1c6d8f2408adb036f1b78d627452b3dd56a0285
parente6b5ebca41dda07b76b244462995502d9f6eb10b
selinux: improve error checking in sel_write_load()

Move our existing input sanity checking to the top of sel_write_load()
and add a check to ensure the buffer size is non-zero.

Move a local variable initialization from the declaration to before it
is used.

Minor style adjustments.

Reported-by: Sam Sun <samsun1006219@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/selinuxfs.c