[bug report] scsi: myrb: Add Mylex RAID controller (block interface)

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

 



Hello Hannes Reinecke,

The patch 081ff398c56c: "scsi: myrb: Add Mylex RAID controller (block
interface)" from Oct 17, 2018, leads to the following static checker
warning:

	drivers/scsi/myrb.c:1614 myrb_ldev_queuecommand()
	warn: assigning signed to unsigned: 'mbox->type5.sg_count = nsge' '(-12),0,2-s32max'

drivers/scsi/myrb.c
  1579          if (scmd->sc_data_direction == DMA_NONE)
  1580                  goto submit;
  1581          nsge = scsi_dma_map(scmd);
                ^^^^^^^^^^^^^^^^^^^^^^^^^
nsge can be -ENOMEM;

  1582          if (nsge == 1) {
  1583                  sgl = scsi_sglist(scmd);
  1584                  if (scmd->sc_data_direction == DMA_FROM_DEVICE)
  1585                          mbox->type5.opcode = MYRB_CMD_READ;
  1586                  else
  1587                          mbox->type5.opcode = MYRB_CMD_WRITE;
  1588  
  1589                  mbox->type5.ld.xfer_len = block_cnt;
  1590                  mbox->type5.ld.ldev_num = sdev->id;
  1591                  mbox->type5.lba = lba;
  1592                  mbox->type5.addr = (u32)sg_dma_address(sgl);
  1593          } else {
  1594                  struct myrb_sge *hw_sgl;
  1595                  dma_addr_t hw_sgl_addr;
  1596                  int i;
  1597  
  1598                  hw_sgl = dma_pool_alloc(cb->sg_pool, GFP_ATOMIC, &hw_sgl_addr);
  1599                  if (!hw_sgl)
  1600                          return SCSI_MLQUEUE_HOST_BUSY;
  1601  
  1602                  cmd_blk->sgl = hw_sgl;
  1603                  cmd_blk->sgl_addr = hw_sgl_addr;
  1604  
  1605                  if (scmd->sc_data_direction == DMA_FROM_DEVICE)
  1606                          mbox->type5.opcode = MYRB_CMD_READ_SG;
  1607                  else
  1608                          mbox->type5.opcode = MYRB_CMD_WRITE_SG;
  1609  
  1610                  mbox->type5.ld.xfer_len = block_cnt;
  1611                  mbox->type5.ld.ldev_num = sdev->id;
  1612                  mbox->type5.lba = lba;
  1613                  mbox->type5.addr = hw_sgl_addr;
  1614                  mbox->type5.sg_count = nsge;
  1615  
  1616                  scsi_for_each_sg(scmd, sgl, nsge, i) {
  1617                          hw_sgl->sge_addr = (u32)sg_dma_address(sgl);
  1618                          hw_sgl->sge_count = (u32)sg_dma_len(sgl);
  1619                          hw_sgl++;
  1620                  }
  1621          }
  1622  submit:
  1623          spin_lock_irqsave(&cb->queue_lock, flags);

regards,
dan carpenter



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux