[bug report] crypto: ccp - Let a v5 CCP provide the same function as v3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Gary R Hook,

The patch 4b394a232df7: "crypto: ccp - Let a v5 CCP provide the same
function as v3" from Jul 26, 2016, leads to the following static
checker warning:

	drivers/crypto/ccp/ccp-dev-v5.c:30 ccp_lsb_alloc()
	warn: always true condition '(cmd_q->lsb >= 0) => (0-u32max >= 0)'

drivers/crypto/ccp/ccp-dev-v5.c
    24  static u32 ccp_lsb_alloc(struct ccp_cmd_queue *cmd_q, unsigned int count)
    25  {
    26          struct ccp_device *ccp;
    27          int start;
    28  
    29          /* First look at the map for the queue */
    30          if (cmd_q->lsb >= 0) {
                    ^^^^^^^^^^^^^^^

->lsb is a u32 so this is always true.

    31                  start = (u32)bitmap_find_next_zero_area(cmd_q->lsbmap,
    32                                                          LSB_SIZE,
    33                                                          0, count, 0);
    34                  if (start < LSB_SIZE) {
    35                          bitmap_set(cmd_q->lsbmap, start, count);
    36                          return start + cmd_q->lsb * LSB_SIZE;
    37                  }
    38          }
    39  
    40          /* No joy; try to get an entry from the shared blocks */
    41          ccp = cmd_q->ccp;
    42          for (;;) {
    43                  mutex_lock(&ccp->sb_mutex);
    44  
    45                  start = (u32)bitmap_find_next_zero_area(ccp->lsbmap,
    46                                                          MAX_LSB_CNT * LSB_SIZE,
    47                                                          0,
    48                                                          count, 0);
    49                  if (start <= MAX_LSB_CNT * LSB_SIZE) {
    50                          bitmap_set(ccp->lsbmap, start, count);
    51  
    52                          mutex_unlock(&ccp->sb_mutex);
    53                          return start * LSB_ITEM_SIZE;
    54                  }
    55  
    56                  ccp->sb_avail = 0;
    57  
    58                  mutex_unlock(&ccp->sb_mutex);
    59  
    60                  /* Wait for KSB entries to become available */
    61                  if (wait_event_interruptible(ccp->sb_queue, ccp->sb_avail))
    62                          return 0;
    63          }
    64  }


regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux