• John Hubbard's avatar
    misc: xilinx-sdfec: improve get_user_pages_fast() error handling · 57343d51
    John Hubbard authored
    This fixes the case of get_user_pages_fast() returning a -errno.
    The result needs to be stored in a signed integer. And for safe
    signed/unsigned comparisons, it's best to keep everything signed.
    And get_user_pages_fast() also expects a signed value for number
    of pages to pin.
    
    Therefore, change most relevant variables, from u32 to int. Leave
    "n" unsigned, for convenience in checking for overflow. And provide
    a WARN_ON_ONCE() and early return, if overflow occurs.
    
    Also, as long as we're tidying up: rename the page array from page,
    to pages, in order to match the conventions used in most other call
    sites.
    
    Fixes: 20ec628e ("misc: xilinx_sdfec: Add ability to configure LDPC")
    Cc: Derek Kiernan <derek.kiernan@xilinx.com>
    Cc: Dragan Cvetic <dragan.cvetic@xilinx.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Michal Simek <michal.simek@xilinx.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
    Link: https://lore.kernel.org/r/20200527012628.1100649-2-jhubbard@nvidia.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    57343d51
xilinx_sdfec.c 38.5 KB