public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* re: [SCSI] bfa: Firmware patch simplification
@ 2013-12-17 14:57 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-12-17 14:57 UTC (permalink / raw)
  To: vmohan; +Cc: linux-scsi

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-17 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-17 14:57 [SCSI] bfa: Firmware patch simplification Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox