From: Ben Hutchings Date: Wed, 1 Feb 2012 09:32:25 +0000 (+0000) Subject: ethtool: Null-terminate filename passed to ethtool_ops::flash_device X-Git-Tag: v2.6.39-400.9.0~423^2~124^2~24 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4c590db80cbf037ec61187114fad1e1a0dcf91e4;p=users%2Fjedix%2Flinux-maple.git ethtool: Null-terminate filename passed to ethtool_ops::flash_device The parameters for ETHTOOL_FLASHDEV include a filename, which ought to be null-terminated. Currently the only driver that implements ethtool_ops::flash_device attempts to add a null terminator if necessary, but does it wrongly. Do it in the ethtool core instead. Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller --- diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 87ca470d0702..18e5e7cee7be 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c @@ -774,12 +774,8 @@ static int be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) { struct be_adapter *adapter = netdev_priv(netdev); - char file_name[ETHTOOL_FLASH_MAX_FILENAME]; - file_name[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0; - strcpy(file_name, efl->data); - - return be_load_fw(adapter, file_name); + return be_load_fw(adapter, efl->data); } static int