Skip to contentSkip to conversation

bfa: Firmware patch simplification

SCSI Dan Carpenter 1 participant 1 message Dec 17, 2013 SCSI

lore
Share & tools
lore
#0 lore raw

Hello Vijaya Mohan Guvva,

The patch 4e88a72d1574: "[SCSI] bfa: Firmware patch simplification" from Nov 21, 2013, leads to the following Smatch warning:

	drivers/scsi/bfa/bfa_ioc.c:6859 bfa_flash_status_read()
	warn: unsigned 'status' is never less than zero.

drivers/scsi/bfa/bfa_ioc.c
6851 bfa_flash_status_read(void __iomem *pci_bar) 6852 {

  6853          union bfa_flash_dev_status_reg_u        dev_status;
  6854          u32                             status;
  6855          u32                     ret_status;
  6856          int                             i;
  6857  
  6858          status = bfa_flash_fifo_flush(pci_bar);
  6859          if (status < 0)
                    ^^^^^^^^^^

"status" is unsigned.

6860 return status;

There are some other Smatch warnings as well:

drivers/scsi/bfa/bfa_ioc.c:3882 bfa_sfp_show_comp() error: memcpy() 'des' too small (64 vs 248)

This is not a real bug, it's just an over-sight. The code uses:

	u8 *des = (u8 *) &(sfp->sfpmem->srlid_base);
but the intent was:
	void *dest = &sfp->sfpmem;

The two assignments are equivalent in terms of pointer math, but we are refering to the whole struct and not the first member.

The other warnings are real:

drivers/scsi/bfa/bfa_ioc.c:6859 bfa_flash_status_read() warn: unsigned 'status' is never less than zero. drivers/scsi/bfa/bfa_ioc.c:6881 bfa_flash_status_read() warn: unsigned 'status' is never less than zero. drivers/scsi/bfa/bfa_ioc.c:6917 bfa_flash_read_start() warn: unsigned 'status' is never less than zero. drivers/scsi/bfa/bfa_ioc.c:7043 bfa_flash_raw_read() warn: unsigned 'status' is never less than zero.

regards,
dan carpenter