]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:47:27 +0000 (23:47 -0500)
commitf80d6ef8a0d03872c7cffb0a5d8591acd29d2262
tree7fd20c1899d435054a6c0d131505e5e70f5666e6
parent0b7224b258597cb29a38d355df64ea90e76ac12e
apparmor: fix unsigned len comparison with less than zero

BugLink: https://bugs.launchpad.net/bugs/1860602
[ Upstream commit 00e0590dbaec6f1bcaa36a85467d7e3497ced522 ]

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: f1bd904175e8 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/apparmor/label.c