[Open-FCoE] [PATCH] libfcoe: Fix erroneous lookup handling

Zou, Yi yi.zou at intel.com
Tue Jan 18 05:31:30 UTC 2011


> 
> Yi, Please include it in your v4 patch set.
> 
> Thanks,
> Bhanu
You beat me to it, yeah, that's the bug I was talking about.

yi

> 
> From: Nithin Sujir <nithin at broadcom.com>
> 
> Return NULL if the match fails.
> 
> Signed-off-by: Nithin Nayak Sujir <nsujir at broadcom.com>
> Signed-off-by: Bhanu Prakash Gollapudi <bprakash at broadcom.com>
> 
> diff --git a/drivers/scsi/fcoe/fcoe_transport.c
> b/drivers/scsi/fcoe/fcoe_transport.c
> index 95fe16b..ba09301 100644
> --- a/drivers/scsi/fcoe/fcoe_transport.c
> +++ b/drivers/scsi/fcoe/fcoe_transport.c
> @@ -87,10 +87,10 @@ static struct fcoe_transport
> *fcoe_transport_lookup(const char *drv_name)
> 
>  	list_for_each_entry(ft, &fcoe_transports, list) {
>  		if (strcmp(drv_name, ft->name) == 0)
> -			break;
> +			return ft;
>  	}
> 
> -	return ft;
> +	return NULL;
>  }
> 
>  /**
> @@ -210,11 +210,10 @@ static void fcoe_del_netdev_mapping(struct
> net_device *netdev)
>  	list_for_each_entry_safe(nm, tmp, &fcoe_netdevs, list) {
>  		if (nm->netdev == netdev) {
>  			list_del(&nm->list);
> -			break;
> +			kfree(nm);
> +			return;
>  		}
>  	}
> -
> -	kfree(nm);
>  }
> 
> 
> @@ -235,11 +234,11 @@ static struct fcoe_transport
> *fcoe_netdev_map_lookup(struct net_device *netdev)
>  	list_for_each_entry(nm, &fcoe_netdevs, list) {
>  		if (netdev == nm->netdev) {
>  			ft = nm->ft;
> -			break;
> +			return ft;
>  		}
>  	}
> 
> -	return ft;
> +	return NULL;
>  }
> 
>  /**
> 
> 
> 
> _______________________________________________
> devel mailing list
> devel at open-fcoe.org
> https://lists.open-fcoe.org/mailman/listinfo/devel



More information about the devel mailing list