]> git.baikalelectronics.ru Git - kernel.git/commit
6lowpan: iphc: Fix an off-by-one check of array index
authorColin Ian King <colin.king@canonical.com>
Mon, 12 Jul 2021 12:14:40 +0000 (13:14 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 22 Jul 2021 14:19:03 +0000 (16:19 +0200)
commitb8ceebee919cc1da4dbe6f50f9f969681565bc0a
tree4a9dcdf7b326587e5a57bc53a275f864edad9225
parent8a159eb68cd7688754d5743acaaeca8b42bb359b
6lowpan: iphc: Fix an off-by-one check of array index

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: 5ff57533e3fa ("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>
net/6lowpan/debugfs.c