@@ -140,8 +140,7 @@ int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
ret = __ethtool_get_link_ksettings(dev, &ksettings);
if (ret < 0) {
- if (info)
- GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
+ GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
goto out_ops;
}
lsettings = &ksettings.base;
@@ -353,8 +353,7 @@ int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info)
ret = __ethtool_get_link_ksettings(dev, &ksettings);
if (ret < 0) {
- if (info)
- GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
+ GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
goto out_ops;
}
Found by smatch: net/ethtool/linkmodes.c:356 ethnl_set_linkmodes() warn: variable dereferenced before check 'info' (see line 332) net/ethtool/linkinfo.c:143 ethnl_set_linkinfo() warn: variable dereferenced before check 'info' (see line 119 In both cases non-zero 'info' is always provided by caller. Signed-off-by: Vasily Averin <vvs@virtuozzo.com> --- net/ethtool/linkinfo.c | 3 +-- net/ethtool/linkmodes.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)