Skip to contentSkip to conversation

memstick: add support for legacy memorysticks

DISCUSSION Dan Carpenter 1 participant 2 messages Sep 21, 2012

lore
Share & tools
lore
#0 lore raw

Hello Maxim Levitsky,

The patch d59dd7c61b24: "memstick: add support for legacy memorysticks" from Sep 21, 2012, leads to the following warning:
drivers/memstick/core/ms_block.c:147 sg_compare_to_buffer()
warn: signedness bug returning '-1'

   141  
   142          if (!retval && len)
   143                  retval = -1;
                        ^^^^^^^^^^^
   144  
   145          sg_miter_stop(&miter);
   146          local_irq_restore(flags);
   147          return retval;
   148  }

This function is bool so it always returns true if len is non-zero.

The comments at the top of the function don't talk about if a 1 means the same and 0 means different or if it's the other way around.

regards,
dan carpenter

#1 lore raw

Here are some other Smatch complaints as well.

drivers/memstick/core/ms_block.c:990 msb_verify_block() warn: signedness bug returning '-5' drivers/memstick/core/ms_block.c:996 msb_verify_block() warn: signedness bug returning '-5' drivers/memstick/core/ms_block.c:1410 msb_ftl_scan() warn: possible memory leak of 'overwrite_flags'

regards,
dan carpenter