]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipa: avoid field overflow
authorAlex Elder <elder@linaro.org>
Fri, 5 Feb 2021 22:11:00 +0000 (16:11 -0600)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Feb 2021 22:57:20 +0000 (14:57 -0800)
commit21730aaea32334cb732344c372b267c8829287ab
tree88de441490e429251cb947fdaa30a4d4d9a75262
parent6f75c4ef16a5a6efd9cd70e3e9569052589cd7a8
net: ipa: avoid field overflow

It's possible that the length passed to ipa_header_size_encoded()
is larger than what can be represented by the HDR_LEN field alone
(starting with IPA v4.5).  If we attempted that, u32_encode_bits()
would trigger a build-time error.

Avoid this problem by masking off high-order bits of the value
encoded as the lower portion of the header length.

The same sort of problem exists in ipa_metadata_offset_encoded(),
so implement the same fix there.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/ipa_reg.h