All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [next-queue RFC 2/4] ethtool: Add support for configuring frame preemption via netlink
Date: Mon, 18 May 2020 15:27:23 +0300	[thread overview]
Message-ID: <20200518122723.GH2078@kadam> (raw)
In-Reply-To: <20200516012948.3173993-3-vinicius.gomes@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3873 bytes --]

Hi Vinicius,

url:    https://github.com/0day-ci/linux/commits/Vinicius-Costa-Gomes/ethtool-Add-support-for-frame-preemption/20200516-093235
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/ethtool/preempt.c:152 ethnl_set_preempt() warn: variable dereferenced before check 'info' (see line 127)

# https://github.com/0day-ci/linux/commit/5d130ebd7a21741d4fda1c8829a32353e10d49d5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 5d130ebd7a21741d4fda1c8829a32353e10d49d5
vim +/info +152 net/ethtool/preempt.c

5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  118  int ethnl_set_preempt(struct sk_buff *skb, struct genl_info *info)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  119  {
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  120  	struct nlattr *tb[ETHTOOL_A_LINKINFO_MAX + 1];
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  121  	struct ethtool_fp preempt = {};
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  122  	struct ethnl_req_info req_info = {};
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  123  	struct net_device *dev;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  124  	bool mod = false;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  125  	int ret;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  126  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15 @127  	ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
                                                                          ^^^^^^^^^^^
Unchecked dereference.

5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  128  			  ETHTOOL_A_PREEMPT_MAX, preempt_set_policy,
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  129  			  info->extack);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  130  	if (ret < 0)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  131  		return ret;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  132  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  133  	ret = ethnl_parse_header_dev_get(&req_info,
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  134  					 tb[ETHTOOL_A_PREEMPT_HEADER],
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  135  					 genl_info_net(info), info->extack,
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  136  					 true);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  137  	if (ret < 0)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  138  		return ret;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  139  	dev = req_info.dev;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  140  	ret = -EOPNOTSUPP;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  141  	if (!dev->ethtool_ops->get_preempt ||
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  142  	    !dev->ethtool_ops->set_preempt)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  143  		goto out_dev;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  144  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  145  	rtnl_lock();
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  146  	ret = ethnl_ops_begin(dev);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  147  	if (ret < 0)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  148  		goto out_rtnl;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  149  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  150  	ret = dev->ethtool_ops->get_preempt(dev, &preempt);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  151  	if (ret < 0) {
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15 @152  		if (info)
                                                                ^^^^^^^^^
Check is too late to help.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [next-queue RFC 2/4] ethtool: Add support for configuring frame preemption via netlink
Date: Mon, 18 May 2020 15:27:23 +0300	[thread overview]
Message-ID: <20200518122723.GH2078@kadam> (raw)
In-Reply-To: <20200516012948.3173993-3-vinicius.gomes@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3873 bytes --]

Hi Vinicius,

url:    https://github.com/0day-ci/linux/commits/Vinicius-Costa-Gomes/ethtool-Add-support-for-frame-preemption/20200516-093235
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/ethtool/preempt.c:152 ethnl_set_preempt() warn: variable dereferenced before check 'info' (see line 127)

# https://github.com/0day-ci/linux/commit/5d130ebd7a21741d4fda1c8829a32353e10d49d5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 5d130ebd7a21741d4fda1c8829a32353e10d49d5
vim +/info +152 net/ethtool/preempt.c

5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  118  int ethnl_set_preempt(struct sk_buff *skb, struct genl_info *info)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  119  {
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  120  	struct nlattr *tb[ETHTOOL_A_LINKINFO_MAX + 1];
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  121  	struct ethtool_fp preempt = {};
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  122  	struct ethnl_req_info req_info = {};
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  123  	struct net_device *dev;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  124  	bool mod = false;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  125  	int ret;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  126  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15 @127  	ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
                                                                          ^^^^^^^^^^^
Unchecked dereference.

5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  128  			  ETHTOOL_A_PREEMPT_MAX, preempt_set_policy,
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  129  			  info->extack);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  130  	if (ret < 0)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  131  		return ret;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  132  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  133  	ret = ethnl_parse_header_dev_get(&req_info,
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  134  					 tb[ETHTOOL_A_PREEMPT_HEADER],
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  135  					 genl_info_net(info), info->extack,
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  136  					 true);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  137  	if (ret < 0)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  138  		return ret;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  139  	dev = req_info.dev;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  140  	ret = -EOPNOTSUPP;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  141  	if (!dev->ethtool_ops->get_preempt ||
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  142  	    !dev->ethtool_ops->set_preempt)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  143  		goto out_dev;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  144  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  145  	rtnl_lock();
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  146  	ret = ethnl_ops_begin(dev);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  147  	if (ret < 0)
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  148  		goto out_rtnl;
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  149  
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  150  	ret = dev->ethtool_ops->get_preempt(dev, &preempt);
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15  151  	if (ret < 0) {
5d130ebd7a2174 Vinicius Costa Gomes 2020-05-15 @152  		if (info)
                                                                ^^^^^^^^^
Check is too late to help.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

  reply	other threads:[~2020-05-18 12:27 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  1:29 [Intel-wired-lan] [next-queue RFC 0/4] ethtool: Add support for frame preemption Vinicius Costa Gomes
2020-05-16  1:29 ` Vinicius Costa Gomes
2020-05-16  1:29 ` [Intel-wired-lan] [next-queue RFC 1/4] ethtool: Add support for configuring " Vinicius Costa Gomes
2020-05-16  1:29   ` Vinicius Costa Gomes
2020-05-19 15:27   ` [Intel-wired-lan] " Murali Karicheri
2020-05-19 15:27     ` Murali Karicheri
2020-05-16  1:29 ` [Intel-wired-lan] [next-queue RFC 2/4] ethtool: Add support for configuring frame preemption via netlink Vinicius Costa Gomes
2020-05-16  1:29   ` Vinicius Costa Gomes
2020-05-18 12:27   ` Dan Carpenter [this message]
2020-05-18 12:27     ` Dan Carpenter
2020-05-16  1:29 ` [Intel-wired-lan] [next-queue RFC 3/4] igc: Add support for configuring frame preemption Vinicius Costa Gomes
2020-05-16  1:29   ` Vinicius Costa Gomes
2020-05-19 16:36   ` [Intel-wired-lan] " Murali Karicheri
2020-05-19 16:36     ` Murali Karicheri
2020-05-16  1:29 ` [Intel-wired-lan] [next-queue RFC 4/4] igc: Add support for exposing frame preemption stats registers Vinicius Costa Gomes
2020-05-16  1:29   ` Vinicius Costa Gomes
2020-05-20 12:50   ` [Intel-wired-lan] " Murali Karicheri
2020-05-20 12:50     ` Murali Karicheri
2020-05-16  9:33 ` [Intel-wired-lan] [next-queue RFC 0/4] ethtool: Add support for frame preemption Michal Kubecek
2020-05-16  9:33   ` Michal Kubecek
2020-05-18 19:34   ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-18 19:34     ` Vinicius Costa Gomes
2020-05-19 22:40     ` [Intel-wired-lan] " Andre Guedes
2020-05-19 22:40       ` Andre Guedes
2020-05-19 22:53       ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-19 22:53         ` Vinicius Costa Gomes
2020-05-16 20:37 ` [Intel-wired-lan] " David Miller
2020-05-16 20:37   ` David Miller
2020-05-16 21:03   ` [Intel-wired-lan] " Vladimir Oltean
2020-05-16 21:03     ` Vladimir Oltean
2020-05-16 22:19     ` [Intel-wired-lan] " David Miller
2020-05-16 22:19       ` David Miller
2020-05-17 10:51       ` [Intel-wired-lan] " Vladimir Oltean
2020-05-17 10:51         ` Vladimir Oltean
2020-05-17 18:45         ` [Intel-wired-lan] " Andrew Lunn
2020-05-17 18:45           ` Andrew Lunn
2020-05-17 19:04           ` [Intel-wired-lan] " Vladimir Oltean
2020-05-17 19:04             ` Vladimir Oltean
2020-05-18 19:05       ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-18 19:05         ` Vinicius Costa Gomes
2020-05-18 20:56         ` [Intel-wired-lan] " Jakub Kicinski
2020-05-18 20:56           ` Jakub Kicinski
2020-05-18 22:06           ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-18 22:06             ` Vinicius Costa Gomes
2020-05-18 22:22             ` [Intel-wired-lan] " Jakub Kicinski
2020-05-18 22:22               ` Jakub Kicinski
2020-05-18 23:05               ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-18 23:05                 ` Vinicius Costa Gomes
2020-05-18 23:09                 ` [Intel-wired-lan] " Jakub Kicinski
2020-05-18 23:09                   ` Jakub Kicinski
2020-05-20 21:42                   ` [Intel-wired-lan] " Andre Guedes
2020-05-20 21:42                     ` Andre Guedes
2020-05-20 22:35                     ` Vinicius Costa Gomes
2020-05-20 22:35                       ` Vinicius Costa Gomes
2020-05-19 16:34             ` Murali Karicheri
2020-05-19 16:34               ` Murali Karicheri
2020-05-19 17:49               ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-19 17:49                 ` Vinicius Costa Gomes
2020-05-17 15:06 ` Michael Walle
2020-05-18 13:36   ` Murali Karicheri
2020-05-19 20:41     ` Michael Walle
2020-05-19 14:53 ` [Intel-wired-lan] " Murali Karicheri
2020-05-19 14:53   ` Murali Karicheri
2020-05-19 15:32   ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-19 15:32     ` Vinicius Costa Gomes
2020-05-19 16:11     ` [Intel-wired-lan] " Murali Karicheri
2020-05-19 16:11       ` Murali Karicheri
2020-05-19 22:39 ` [Intel-wired-lan] " Andre Guedes
2020-05-19 22:39   ` Andre Guedes
2020-05-19 23:37   ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-19 23:37     ` Vinicius Costa Gomes
2020-05-20 12:47     ` [Intel-wired-lan] " Murali Karicheri
2020-05-20 12:47       ` Murali Karicheri
2020-05-20 12:52     ` [Intel-wired-lan] " Joergen Andreasen
2020-05-20 12:52       ` Joergen Andreasen
2020-05-20 21:32       ` [Intel-wired-lan] " Vinicius Costa Gomes
2020-05-20 21:32         ` Vinicius Costa Gomes
  -- strict thread matches above, loose matches on Subject: below --
2020-05-16  5:06 [next-queue RFC 2/4] ethtool: Add support for configuring frame preemption via netlink kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200518122723.GH2078@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.