lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 422/917] memstick: avoid out-of-range warning
    Date
    From: Arnd Bergmann <arnd@arndb.de>

    [ Upstream commit 4853396f03c3019eccf5cd113e464231e9ddf0b3 ]

    clang-14 complains about a sanity check that always passes when the
    page size is 64KB or larger:

    drivers/memstick/core/ms_block.c:1739:21: error: result of comparison of constant 65536 with expression of type 'unsigned short' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
    if (msb->page_size > PAGE_SIZE) {
    ~~~~~~~~~~~~~~ ^ ~~~~~~~~~

    This is fine, it will still work on all architectures, so just shut
    up that warning with a cast.

    Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20210927094520.696665-1-arnd@kernel.org
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/memstick/core/ms_block.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
    index acf36676e388d..487e4cc2951e0 100644
    --- a/drivers/memstick/core/ms_block.c
    +++ b/drivers/memstick/core/ms_block.c
    @@ -1736,7 +1736,7 @@ static int msb_init_card(struct memstick_dev *card)
    msb->pages_in_block = boot_block->attr.block_size * 2;
    msb->block_size = msb->page_size * msb->pages_in_block;

    - if (msb->page_size > PAGE_SIZE) {
    + if ((size_t)msb->page_size > PAGE_SIZE) {
    /* this isn't supported by linux at all, anyway*/
    dbg("device page %d size isn't supported", msb->page_size);
    return -EINVAL;
    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-16 01:42    [W:3.100 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site