Skip to contentSkip to conversation

fnic: Add new Cisco PCI-Express FCoE HBA

bug report Dan Carpenter 1 participant 1 message Oct 30, 2020 SCSI

lore
Share & tools
lore
#0 lore raw

Hello Abhijeet Joglekar,

The patch 5df6d737dd4b: "[SCSI] fnic: Add new Cisco PCI-Express FCoE HBA" from Apr 17, 2009, leads to the following static checker warning:

    drivers/scsi/fnic/fnic_res.c:96 fnic_get_vnic_config()
    warn: '__UNIQUE_ID___x1297' 255000 can't fit into 65535 'c->ed_tov'

    drivers/scsi/fnic/fnic_res.c:101 fnic_get_vnic_config()
    warn: '__UNIQUE_ID___x1301' 255000 can't fit into 65535 'c->ra_tov'

drivers/scsi/fnic/fnic_res.c

    89          c->rq_desc_count = ALIGN(c->rq_desc_count, 16);
    90  
    91          c->maxdatafieldsize =
    92                  min_t(u16, VNIC_FNIC_MAXDATAFIELDSIZE_MAX,
    93                        max_t(u16, VNIC_FNIC_MAXDATAFIELDSIZE_MIN,
    94                              c->maxdatafieldsize));
    95          c->ed_tov =
    96                  min_t(u32, VNIC_FNIC_EDTOV_MAX,
    97                        max_t(u32, VNIC_FNIC_EDTOV_MIN,
    98                              c->ed_tov));

The VNIC_FNIC_EDTOV_MAX is 255000 but c->ed_tov is a u16 so the max is way outside of the maximum that the type says it can be.

    99  
   100          c->ra_tov =
   101                  min_t(u32, VNIC_FNIC_RATOV_MAX,
                                    ^^^^^^^^^^^^^^^^^^

Same.

   102                        max_t(u32, VNIC_FNIC_RATOV_MIN,
   103                              c->ra_tov));
   104  
   105          c->flogi_retries =
   106                  min_t(u32, VNIC_FNIC_FLOGI_RETRIES_MAX, c->flogi_retries);

regards,
dan carpenter