Commit d97772db authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

ethtool: fix ->reply_size() error handling

The "ret < 0" comparison is never true because "ret" is still zero.

Fixes: 728480f1 ("ethtool: default handlers for GET requests")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a6dd0480
...@@ -319,9 +319,10 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -319,9 +319,10 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info)
rtnl_unlock(); rtnl_unlock();
if (ret < 0) if (ret < 0)
goto err_cleanup; goto err_cleanup;
reply_len = ops->reply_size(req_info, reply_data); ret = ops->reply_size(req_info, reply_data);
if (ret < 0) if (ret < 0)
goto err_cleanup; goto err_cleanup;
reply_len = ret;
ret = -ENOMEM; ret = -ENOMEM;
rskb = ethnl_reply_init(reply_len, req_info->dev, ops->reply_cmd, rskb = ethnl_reply_init(reply_len, req_info->dev, ops->reply_cmd,
ops->hdr_attr, info, &reply_payload); ops->hdr_attr, info, &reply_payload);
...@@ -555,9 +556,10 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd, ...@@ -555,9 +556,10 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd,
ret = ops->prepare_data(req_info, reply_data, NULL); ret = ops->prepare_data(req_info, reply_data, NULL);
if (ret < 0) if (ret < 0)
goto err_cleanup; goto err_cleanup;
reply_len = ops->reply_size(req_info, reply_data); ret = ops->reply_size(req_info, reply_data);
if (ret < 0) if (ret < 0)
goto err_cleanup; goto err_cleanup;
reply_len = ret;
ret = -ENOMEM; ret = -ENOMEM;
skb = genlmsg_new(reply_len, GFP_KERNEL); skb = genlmsg_new(reply_len, GFP_KERNEL);
if (!skb) if (!skb)
......
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