public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: vmohan@brocade.com
Cc: linux-scsi@vger.kernel.org
Subject: re: [SCSI] bfa: Firmware patch simplification
Date: Tue, 17 Dec 2013 17:57:15 +0300	[thread overview]
Message-ID: <20131217145715.GA32365@elgon.mountain> (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


                 reply	other threads:[~2013-12-17 14:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131217145715.GA32365@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=vmohan@brocade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox