• Alex Elder's avatar
    net: ipa: fix register write command validation · 2d65ed76
    Alex Elder authored
    In ipa_cmd_register_write_valid() we verify that values we will
    supply to a REGISTER_WRITE IPA immediate command will fit in
    the fields that need to hold them.  This patch fixes some issues
    in that function and ipa_cmd_register_write_offset_valid().
    
    The dev_err() call in ipa_cmd_register_write_offset_valid() has
    some printf format errors:
      - The name of the register (corresponding to the string format
        specifier) was not supplied.
      - The IPA base offset and offset need to be supplied separately to
        match the other format specifiers.
    Also make the ~0 constant used there to compute the maximum
    supported offset value explicitly unsigned.
    
    There are two other issues in ipa_cmd_register_write_valid():
      - There's no need to check the hash flush register for platforms
        (like IPA v4.2) that do not support hashed tables
      - The highest possible endpoint number, whose status register
        offset is computed, is COUNT - 1, not COUNT.
    
    Fix these problems, and add some additional commentary.
    Signed-off-by: default avatarAlex Elder <elder@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2d65ed76
ipa_cmd.c 21.1 KB