diff options
| author | Neerav Parikh <Neerav.Parikh@intel.com> | 2013-05-18 01:12:28 -0400 |
|---|---|---|
| committer | Robert Love <robert.w.love@intel.com> | 2013-07-09 12:29:17 -0400 |
| commit | f07d46bbc9ba9a08b338dec7bb858977d4d822fb (patch) | |
| tree | 8b92eff8a65ef21f4abc86abb8132e5fccb1f7ff /drivers | |
| parent | e0335f67a281cb8eb11868e614ee9390fbbe9b1d (diff) | |
fcoe: Fix smatch warning in fcoe_fdmi_info function
This patch fixes a smatch warning as below:
smatch warnings:
drivers/scsi/fcoe/fcoe.c:782 fcoe_fdmi_info() warn: 'fdmi' puts 896 bytes on
stack
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Neerav Parikh <Neerav.Parikh@intel.com>
Tested-by: Jack Morgan <jack.morgan@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 32ae6c67ea3a..3336e5754930 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
| @@ -774,7 +774,6 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) | |||
| 774 | struct fcoe_port *port; | 774 | struct fcoe_port *port; |
| 775 | struct net_device *realdev; | 775 | struct net_device *realdev; |
| 776 | int rc; | 776 | int rc; |
| 777 | struct netdev_fcoe_hbainfo fdmi; | ||
| 778 | 777 | ||
| 779 | port = lport_priv(lport); | 778 | port = lport_priv(lport); |
| 780 | fcoe = port->priv; | 779 | fcoe = port->priv; |
| @@ -788,9 +787,13 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) | |||
| 788 | return; | 787 | return; |
| 789 | 788 | ||
| 790 | if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) { | 789 | if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) { |
| 791 | memset(&fdmi, 0, sizeof(fdmi)); | 790 | struct netdev_fcoe_hbainfo *fdmi; |
| 791 | fdmi = kzalloc(sizeof(*fdmi), GFP_KERNEL); | ||
| 792 | if (!fdmi) | ||
| 793 | return; | ||
| 794 | |||
| 792 | rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev, | 795 | rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev, |
| 793 | &fdmi); | 796 | fdmi); |
| 794 | if (rc) { | 797 | if (rc) { |
| 795 | printk(KERN_INFO "fcoe: Failed to retrieve FDMI " | 798 | printk(KERN_INFO "fcoe: Failed to retrieve FDMI " |
| 796 | "information from netdev.\n"); | 799 | "information from netdev.\n"); |
| @@ -800,38 +803,39 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) | |||
| 800 | snprintf(fc_host_serial_number(lport->host), | 803 | snprintf(fc_host_serial_number(lport->host), |
| 801 | FC_SERIAL_NUMBER_SIZE, | 804 | FC_SERIAL_NUMBER_SIZE, |
| 802 | "%s", | 805 | "%s", |
| 803 | fdmi.serial_number); | 806 | fdmi->serial_number); |
| 804 | snprintf(fc_host_manufacturer(lport->host), | 807 | snprintf(fc_host_manufacturer(lport->host), |
| 805 | FC_SERIAL_NUMBER_SIZE, | 808 | FC_SERIAL_NUMBER_SIZE, |
| 806 | "%s", | 809 | "%s", |
| 807 | fdmi.manufacturer); | 810 | fdmi->manufacturer); |
| 808 | snprintf(fc_host_model(lport->host), | 811 | snprintf(fc_host_model(lport->host), |
| 809 | FC_SYMBOLIC_NAME_SIZE, | 812 | FC_SYMBOLIC_NAME_SIZE, |
| 810 | "%s", | 813 | "%s", |
| 811 | fdmi.model); | 814 | fdmi->model); |
| 812 | snprintf(fc_host_model_description(lport->host), | 815 | snprintf(fc_host_model_description(lport->host), |
| 813 | FC_SYMBOLIC_NAME_SIZE, | 816 | FC_SYMBOLIC_NAME_SIZE, |
| 814 | "%s", | 817 | "%s", |
| 815 | fdmi.model_description); | 818 | fdmi->model_description); |
| 816 | snprintf(fc_host_hardware_version(lport->host), | 819 | snprintf(fc_host_hardware_version(lport->host), |
| 817 | FC_VERSION_STRING_SIZE, | 820 | FC_VERSION_STRING_SIZE, |
| 818 | "%s", | 821 | "%s", |
| 819 | fdmi.hardware_version); | 822 | fdmi->hardware_version); |
| 820 | snprintf(fc_host_driver_version(lport->host), | 823 | snprintf(fc_host_driver_version(lport->host), |
| 821 | FC_VERSION_STRING_SIZE, | 824 | FC_VERSION_STRING_SIZE, |
| 822 | "%s", | 825 | "%s", |
| 823 | fdmi.driver_version); | 826 | fdmi->driver_version); |
| 824 | snprintf(fc_host_optionrom_version(lport->host), | 827 | snprintf(fc_host_optionrom_version(lport->host), |
| 825 | FC_VERSION_STRING_SIZE, | 828 | FC_VERSION_STRING_SIZE, |
| 826 | "%s", | 829 | "%s", |
| 827 | fdmi.optionrom_version); | 830 | fdmi->optionrom_version); |
| 828 | snprintf(fc_host_firmware_version(lport->host), | 831 | snprintf(fc_host_firmware_version(lport->host), |
| 829 | FC_VERSION_STRING_SIZE, | 832 | FC_VERSION_STRING_SIZE, |
| 830 | "%s", | 833 | "%s", |
| 831 | fdmi.firmware_version); | 834 | fdmi->firmware_version); |
| 832 | 835 | ||
| 833 | /* Enable FDMI lport states */ | 836 | /* Enable FDMI lport states */ |
| 834 | lport->fdmi_enabled = 1; | 837 | lport->fdmi_enabled = 1; |
| 838 | kfree(fdmi); | ||
| 835 | } else { | 839 | } else { |
| 836 | lport->fdmi_enabled = 0; | 840 | lport->fdmi_enabled = 0; |
| 837 | printk(KERN_INFO "fcoe: No FDMI support.\n"); | 841 | printk(KERN_INFO "fcoe: No FDMI support.\n"); |
