Commit f07d46bb authored by Neerav Parikh's avatar Neerav Parikh Committed by Robert Love

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: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarNeerav Parikh <Neerav.Parikh@intel.com>
Tested-by: default avatarJack Morgan <jack.morgan@intel.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
parent e0335f67
...@@ -774,7 +774,6 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) ...@@ -774,7 +774,6 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
struct fcoe_port *port; struct fcoe_port *port;
struct net_device *realdev; struct net_device *realdev;
int rc; int rc;
struct netdev_fcoe_hbainfo fdmi;
port = lport_priv(lport); port = lport_priv(lport);
fcoe = port->priv; fcoe = port->priv;
...@@ -788,9 +787,13 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) ...@@ -788,9 +787,13 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
return; return;
if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) { if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) {
memset(&fdmi, 0, sizeof(fdmi)); struct netdev_fcoe_hbainfo *fdmi;
fdmi = kzalloc(sizeof(*fdmi), GFP_KERNEL);
if (!fdmi)
return;
rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev, rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev,
&fdmi); fdmi);
if (rc) { if (rc) {
printk(KERN_INFO "fcoe: Failed to retrieve FDMI " printk(KERN_INFO "fcoe: Failed to retrieve FDMI "
"information from netdev.\n"); "information from netdev.\n");
...@@ -800,38 +803,39 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) ...@@ -800,38 +803,39 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
snprintf(fc_host_serial_number(lport->host), snprintf(fc_host_serial_number(lport->host),
FC_SERIAL_NUMBER_SIZE, FC_SERIAL_NUMBER_SIZE,
"%s", "%s",
fdmi.serial_number); fdmi->serial_number);
snprintf(fc_host_manufacturer(lport->host), snprintf(fc_host_manufacturer(lport->host),
FC_SERIAL_NUMBER_SIZE, FC_SERIAL_NUMBER_SIZE,
"%s", "%s",
fdmi.manufacturer); fdmi->manufacturer);
snprintf(fc_host_model(lport->host), snprintf(fc_host_model(lport->host),
FC_SYMBOLIC_NAME_SIZE, FC_SYMBOLIC_NAME_SIZE,
"%s", "%s",
fdmi.model); fdmi->model);
snprintf(fc_host_model_description(lport->host), snprintf(fc_host_model_description(lport->host),
FC_SYMBOLIC_NAME_SIZE, FC_SYMBOLIC_NAME_SIZE,
"%s", "%s",
fdmi.model_description); fdmi->model_description);
snprintf(fc_host_hardware_version(lport->host), snprintf(fc_host_hardware_version(lport->host),
FC_VERSION_STRING_SIZE, FC_VERSION_STRING_SIZE,
"%s", "%s",
fdmi.hardware_version); fdmi->hardware_version);
snprintf(fc_host_driver_version(lport->host), snprintf(fc_host_driver_version(lport->host),
FC_VERSION_STRING_SIZE, FC_VERSION_STRING_SIZE,
"%s", "%s",
fdmi.driver_version); fdmi->driver_version);
snprintf(fc_host_optionrom_version(lport->host), snprintf(fc_host_optionrom_version(lport->host),
FC_VERSION_STRING_SIZE, FC_VERSION_STRING_SIZE,
"%s", "%s",
fdmi.optionrom_version); fdmi->optionrom_version);
snprintf(fc_host_firmware_version(lport->host), snprintf(fc_host_firmware_version(lport->host),
FC_VERSION_STRING_SIZE, FC_VERSION_STRING_SIZE,
"%s", "%s",
fdmi.firmware_version); fdmi->firmware_version);
/* Enable FDMI lport states */ /* Enable FDMI lport states */
lport->fdmi_enabled = 1; lport->fdmi_enabled = 1;
kfree(fdmi);
} else { } else {
lport->fdmi_enabled = 0; lport->fdmi_enabled = 0;
printk(KERN_INFO "fcoe: No FDMI support.\n"); printk(KERN_INFO "fcoe: No FDMI support.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment