• Alex Elder's avatar
    net: ipa: avoid field overflow · cd115009
    Alex Elder authored
    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: default avatarAlex Elder <elder@linaro.org>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    cd115009
ipa_reg.h 25.4 KB