]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix unsigned len comparison with less than zero
authorColin Ian King <colin.king@canonical.com>
Thu, 27 Jun 2019 13:09:04 +0000 (14:09 +0100)
committerJohn Johansen <john.johansen@canonical.com>
Sat, 23 Nov 2019 00:37:54 +0000 (16:37 -0800)
commit41a10f146755984f43fb387151a5a3deb4b2b107
tree5e5baf491acc9a0bfdfb2070d076d533849bdaba
parent4c4976283f8304dcc92f717cb21fb1ed574cd762
apparmor: fix unsigned len comparison with less than zero

The sanity check in macro update_for_len checks to see if len
is less than zero, however, len is a size_t so it can never be
less than zero, so this sanity check is a no-op.  Fix this by
making len a ssize_t so the comparison will work and add ulen
that is a size_t copy of len so that the min() macro won't
throw warnings about comparing different types.

Addresses-Coverity: ("Macro compares unsigned to 0")
Fixes: 070afe2d9ac6 ("apparmor: add the base fns() for domain labels")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/label.c