All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type?
Date: Thu, 25 Nov 2021 03:58:14 +0800	[thread overview]
Message-ID: <202111250317.VUsGtdox-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Parav Pandit <parav@nvidia.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: Eli Cohen <elic@nvidia.com>
CC: Jason Wang <jasowang@redhat.com>
CC: Eric Dumazet <edumazet@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d9f4cf36721aba199975a9be7863a3ff5cd4b59
commit: 33b347503f014ebf76257327cbc7001c6b721956 vdpa: Define vdpa mgmt device, ops and a netlink interface
date:   9 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 9 months ago
config: i386-randconfig-m021-20211118 (https://download.01.org/0day-ci/archive/20211125/202111250317.VUsGtdox-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type?
drivers/vdpa/vdpa.c:329 vdpa_nl_cmd_mgmtdev_get_doit() warn: passing a valid pointer to 'PTR_ERR'

vim +296 drivers/vdpa/vdpa.c

33b347503f014eb Parav Pandit 2021-01-05  279  
33b347503f014eb Parav Pandit 2021-01-05  280  static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *msg,
33b347503f014eb Parav Pandit 2021-01-05  281  			     u32 portid, u32 seq, int flags)
33b347503f014eb Parav Pandit 2021-01-05  282  {
33b347503f014eb Parav Pandit 2021-01-05  283  	u64 supported_classes = 0;
33b347503f014eb Parav Pandit 2021-01-05  284  	void *hdr;
33b347503f014eb Parav Pandit 2021-01-05  285  	int i = 0;
33b347503f014eb Parav Pandit 2021-01-05  286  	int err;
33b347503f014eb Parav Pandit 2021-01-05  287  
33b347503f014eb Parav Pandit 2021-01-05  288  	hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags, VDPA_CMD_MGMTDEV_NEW);
33b347503f014eb Parav Pandit 2021-01-05  289  	if (!hdr)
33b347503f014eb Parav Pandit 2021-01-05  290  		return -EMSGSIZE;
33b347503f014eb Parav Pandit 2021-01-05  291  	err = vdpa_nl_mgmtdev_handle_fill(msg, mdev);
33b347503f014eb Parav Pandit 2021-01-05  292  	if (err)
33b347503f014eb Parav Pandit 2021-01-05  293  		goto msg_err;
33b347503f014eb Parav Pandit 2021-01-05  294  
33b347503f014eb Parav Pandit 2021-01-05  295  	while (mdev->id_table[i].device) {
33b347503f014eb Parav Pandit 2021-01-05 @296  		supported_classes |= BIT(mdev->id_table[i].device);
33b347503f014eb Parav Pandit 2021-01-05  297  		i++;
33b347503f014eb Parav Pandit 2021-01-05  298  	}
33b347503f014eb Parav Pandit 2021-01-05  299  
33b347503f014eb Parav Pandit 2021-01-05  300  	if (nla_put_u64_64bit(msg, VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,
33b347503f014eb Parav Pandit 2021-01-05  301  			      supported_classes, VDPA_ATTR_UNSPEC)) {
33b347503f014eb Parav Pandit 2021-01-05  302  		err = -EMSGSIZE;
33b347503f014eb Parav Pandit 2021-01-05  303  		goto msg_err;
33b347503f014eb Parav Pandit 2021-01-05  304  	}
33b347503f014eb Parav Pandit 2021-01-05  305  
33b347503f014eb Parav Pandit 2021-01-05  306  	genlmsg_end(msg, hdr);
33b347503f014eb Parav Pandit 2021-01-05  307  	return 0;
33b347503f014eb Parav Pandit 2021-01-05  308  
33b347503f014eb Parav Pandit 2021-01-05  309  msg_err:
33b347503f014eb Parav Pandit 2021-01-05  310  	genlmsg_cancel(msg, hdr);
33b347503f014eb Parav Pandit 2021-01-05  311  	return err;
33b347503f014eb Parav Pandit 2021-01-05  312  }
33b347503f014eb Parav Pandit 2021-01-05  313  
33b347503f014eb Parav Pandit 2021-01-05  314  static int vdpa_nl_cmd_mgmtdev_get_doit(struct sk_buff *skb, struct genl_info *info)
33b347503f014eb Parav Pandit 2021-01-05  315  {
33b347503f014eb Parav Pandit 2021-01-05  316  	struct vdpa_mgmt_dev *mdev;
33b347503f014eb Parav Pandit 2021-01-05  317  	struct sk_buff *msg;
33b347503f014eb Parav Pandit 2021-01-05  318  	int err;
33b347503f014eb Parav Pandit 2021-01-05  319  
33b347503f014eb Parav Pandit 2021-01-05  320  	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
33b347503f014eb Parav Pandit 2021-01-05  321  	if (!msg)
33b347503f014eb Parav Pandit 2021-01-05  322  		return -ENOMEM;
33b347503f014eb Parav Pandit 2021-01-05  323  
33b347503f014eb Parav Pandit 2021-01-05  324  	mutex_lock(&vdpa_dev_mutex);
33b347503f014eb Parav Pandit 2021-01-05  325  	mdev = vdpa_mgmtdev_get_from_attr(info->attrs);
33b347503f014eb Parav Pandit 2021-01-05  326  	if (IS_ERR(mdev)) {
33b347503f014eb Parav Pandit 2021-01-05  327  		mutex_unlock(&vdpa_dev_mutex);
33b347503f014eb Parav Pandit 2021-01-05  328  		NL_SET_ERR_MSG_MOD(info->extack, "Fail to find the specified mgmt device");
33b347503f014eb Parav Pandit 2021-01-05 @329  		err = PTR_ERR(mdev);
33b347503f014eb Parav Pandit 2021-01-05  330  		goto out;
33b347503f014eb Parav Pandit 2021-01-05  331  	}
33b347503f014eb Parav Pandit 2021-01-05  332  
33b347503f014eb Parav Pandit 2021-01-05  333  	err = vdpa_mgmtdev_fill(mdev, msg, info->snd_portid, info->snd_seq, 0);
33b347503f014eb Parav Pandit 2021-01-05  334  	mutex_unlock(&vdpa_dev_mutex);
33b347503f014eb Parav Pandit 2021-01-05  335  	if (err)
33b347503f014eb Parav Pandit 2021-01-05  336  		goto out;
33b347503f014eb Parav Pandit 2021-01-05  337  	err = genlmsg_reply(msg, info);
33b347503f014eb Parav Pandit 2021-01-05  338  	return err;
33b347503f014eb Parav Pandit 2021-01-05  339  
33b347503f014eb Parav Pandit 2021-01-05  340  out:
33b347503f014eb Parav Pandit 2021-01-05  341  	nlmsg_free(msg);
33b347503f014eb Parav Pandit 2021-01-05  342  	return err;
33b347503f014eb Parav Pandit 2021-01-05  343  }
33b347503f014eb Parav Pandit 2021-01-05  344  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)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: drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type?
Date: Thu, 25 Nov 2021 10:03:28 +0300	[thread overview]
Message-ID: <202111250317.VUsGtdox-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d9f4cf36721aba199975a9be7863a3ff5cd4b59
commit: 33b347503f014ebf76257327cbc7001c6b721956 vdpa: Define vdpa mgmt device, ops and a netlink interface
config: i386-randconfig-m021-20211118 (https://download.01.org/0day-ci/archive/20211125/202111250317.VUsGtdox-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type?

vim +296 drivers/vdpa/vdpa.c

33b347503f014eb Parav Pandit 2021-01-05  280  static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *msg,
33b347503f014eb Parav Pandit 2021-01-05  281  			     u32 portid, u32 seq, int flags)
33b347503f014eb Parav Pandit 2021-01-05  282  {
33b347503f014eb Parav Pandit 2021-01-05  283  	u64 supported_classes = 0;
                                                ^^^^^^^^^^^^^^^^^^^^^
This is a u64

33b347503f014eb Parav Pandit 2021-01-05  284  	void *hdr;
33b347503f014eb Parav Pandit 2021-01-05  285  	int i = 0;
33b347503f014eb Parav Pandit 2021-01-05  286  	int err;
33b347503f014eb Parav Pandit 2021-01-05  287  
33b347503f014eb Parav Pandit 2021-01-05  288  	hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags, VDPA_CMD_MGMTDEV_NEW);
33b347503f014eb Parav Pandit 2021-01-05  289  	if (!hdr)
33b347503f014eb Parav Pandit 2021-01-05  290  		return -EMSGSIZE;
33b347503f014eb Parav Pandit 2021-01-05  291  	err = vdpa_nl_mgmtdev_handle_fill(msg, mdev);
33b347503f014eb Parav Pandit 2021-01-05  292  	if (err)
33b347503f014eb Parav Pandit 2021-01-05  293  		goto msg_err;
33b347503f014eb Parav Pandit 2021-01-05  294  
33b347503f014eb Parav Pandit 2021-01-05  295  	while (mdev->id_table[i].device) {
33b347503f014eb Parav Pandit 2021-01-05 @296  		supported_classes |= BIT(mdev->id_table[i].device);

Which suggests that this should be BIT_ULL().

33b347503f014eb Parav Pandit 2021-01-05  297  		i++;
33b347503f014eb Parav Pandit 2021-01-05  298  	}
33b347503f014eb Parav Pandit 2021-01-05  299  
33b347503f014eb Parav Pandit 2021-01-05  300  	if (nla_put_u64_64bit(msg, VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,
33b347503f014eb Parav Pandit 2021-01-05  301  			      supported_classes, VDPA_ATTR_UNSPEC)) {
33b347503f014eb Parav Pandit 2021-01-05  302  		err = -EMSGSIZE;
33b347503f014eb Parav Pandit 2021-01-05  303  		goto msg_err;
33b347503f014eb Parav Pandit 2021-01-05  304  	}
33b347503f014eb Parav Pandit 2021-01-05  305  
33b347503f014eb Parav Pandit 2021-01-05  306  	genlmsg_end(msg, hdr);
33b347503f014eb Parav Pandit 2021-01-05  307  	return 0;
33b347503f014eb Parav Pandit 2021-01-05  308  
33b347503f014eb Parav Pandit 2021-01-05  309  msg_err:
33b347503f014eb Parav Pandit 2021-01-05  310  	genlmsg_cancel(msg, hdr);
33b347503f014eb Parav Pandit 2021-01-05  311  	return err;
33b347503f014eb Parav Pandit 2021-01-05  312  }

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Parav Pandit <parav@nvidia.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Eli Cohen <elic@nvidia.com>, Jason Wang <jasowang@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Subject: drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type?
Date: Thu, 25 Nov 2021 10:03:28 +0300	[thread overview]
Message-ID: <202111250317.VUsGtdox-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d9f4cf36721aba199975a9be7863a3ff5cd4b59
commit: 33b347503f014ebf76257327cbc7001c6b721956 vdpa: Define vdpa mgmt device, ops and a netlink interface
config: i386-randconfig-m021-20211118 (https://download.01.org/0day-ci/archive/20211125/202111250317.VUsGtdox-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type?

vim +296 drivers/vdpa/vdpa.c

33b347503f014eb Parav Pandit 2021-01-05  280  static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *msg,
33b347503f014eb Parav Pandit 2021-01-05  281  			     u32 portid, u32 seq, int flags)
33b347503f014eb Parav Pandit 2021-01-05  282  {
33b347503f014eb Parav Pandit 2021-01-05  283  	u64 supported_classes = 0;
                                                ^^^^^^^^^^^^^^^^^^^^^
This is a u64

33b347503f014eb Parav Pandit 2021-01-05  284  	void *hdr;
33b347503f014eb Parav Pandit 2021-01-05  285  	int i = 0;
33b347503f014eb Parav Pandit 2021-01-05  286  	int err;
33b347503f014eb Parav Pandit 2021-01-05  287  
33b347503f014eb Parav Pandit 2021-01-05  288  	hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags, VDPA_CMD_MGMTDEV_NEW);
33b347503f014eb Parav Pandit 2021-01-05  289  	if (!hdr)
33b347503f014eb Parav Pandit 2021-01-05  290  		return -EMSGSIZE;
33b347503f014eb Parav Pandit 2021-01-05  291  	err = vdpa_nl_mgmtdev_handle_fill(msg, mdev);
33b347503f014eb Parav Pandit 2021-01-05  292  	if (err)
33b347503f014eb Parav Pandit 2021-01-05  293  		goto msg_err;
33b347503f014eb Parav Pandit 2021-01-05  294  
33b347503f014eb Parav Pandit 2021-01-05  295  	while (mdev->id_table[i].device) {
33b347503f014eb Parav Pandit 2021-01-05 @296  		supported_classes |= BIT(mdev->id_table[i].device);

Which suggests that this should be BIT_ULL().

33b347503f014eb Parav Pandit 2021-01-05  297  		i++;
33b347503f014eb Parav Pandit 2021-01-05  298  	}
33b347503f014eb Parav Pandit 2021-01-05  299  
33b347503f014eb Parav Pandit 2021-01-05  300  	if (nla_put_u64_64bit(msg, VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,
33b347503f014eb Parav Pandit 2021-01-05  301  			      supported_classes, VDPA_ATTR_UNSPEC)) {
33b347503f014eb Parav Pandit 2021-01-05  302  		err = -EMSGSIZE;
33b347503f014eb Parav Pandit 2021-01-05  303  		goto msg_err;
33b347503f014eb Parav Pandit 2021-01-05  304  	}
33b347503f014eb Parav Pandit 2021-01-05  305  
33b347503f014eb Parav Pandit 2021-01-05  306  	genlmsg_end(msg, hdr);
33b347503f014eb Parav Pandit 2021-01-05  307  	return 0;
33b347503f014eb Parav Pandit 2021-01-05  308  
33b347503f014eb Parav Pandit 2021-01-05  309  msg_err:
33b347503f014eb Parav Pandit 2021-01-05  310  	genlmsg_cancel(msg, hdr);
33b347503f014eb Parav Pandit 2021-01-05  311  	return err;
33b347503f014eb Parav Pandit 2021-01-05  312  }

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


             reply	other threads:[~2021-11-24 19:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 19:58 kernel test robot [this message]
2021-11-25  7:03 ` drivers/vdpa/vdpa.c:296 vdpa_mgmtdev_fill() warn: should '(((1))) << (mdev->id_table[i]->device)' be a 64 bit type? Dan Carpenter
2021-11-25  7:03 ` Dan Carpenter
2021-11-25 16:15 ` Michael S. Tsirkin
2021-11-25 16:15   ` Michael S. Tsirkin
2021-11-25 16:52   ` Joe Perches
2021-11-25 16:52     ` Joe Perches
2021-11-25 17:33     ` Parav Pandit
2021-11-25 17:33     ` Parav Pandit
2021-11-25 17:39   ` Parav Pandit
2021-11-25 17:39   ` Parav Pandit

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=202111250317.VUsGtdox-lkp@intel.com \
    --to=lkp@intel.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.