mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
6lowpan: iphc: Fix an off-by-one check of array index
[ Upstream commit9af417610b] The bounds check of id is off-by-one and the comparison should be >= rather >. Currently the WARN_ON_ONCE check does not stop the out of range indexing of &ldev->ctx.table[id] so also add a return path if the bounds are out of range. Addresses-Coverity: ("Illegal address computation"). Fixes:5609c185f2("6lowpan: iphc: add support for stateful compression") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
def6efdf91
commit
c7ebd3622b
@@ -170,7 +170,8 @@ static void lowpan_dev_debugfs_ctx_init(struct net_device *dev,
|
|||||||
struct dentry *root;
|
struct dentry *root;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
WARN_ON_ONCE(id > LOWPAN_IPHC_CTX_TABLE_SIZE);
|
if (WARN_ON_ONCE(id >= LOWPAN_IPHC_CTX_TABLE_SIZE))
|
||||||
|
return;
|
||||||
|
|
||||||
sprintf(buf, "%d", id);
|
sprintf(buf, "%d", id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user