From: Gavin Shan <gshan@redhat.com>
To: kernel test robot <lkp@intel.com>, virtualization@lists.linux.dev
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
mst@redhat.com, jasowang@redhat.com, shan.gavin@gmail.com
Subject: Re: [PATCH 3/4] vhost: Improve vhost_get_avail_head()
Date: Fri, 26 Apr 2024 08:45:44 +1000 [thread overview]
Message-ID: <9237d933-406d-4120-a5fd-34a238f2ccdb@redhat.com> (raw)
In-Reply-To: <202404260448.g7F06v7M-lkp@intel.com>
On 4/26/24 06:42, kernel test robot wrote:> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on mst-vhost/linux-next]
> [also build test WARNING on linus/master v6.9-rc5 next-20240424]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Gavin-Shan/vhost-Drop-variable-last_avail_idx-in-vhost_get_vq_desc/20240423-112803
> base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
> patch link: https://lore.kernel.org/r/20240423032407.262329-4-gshan%40redhat.com
> patch subject: [PATCH 3/4] vhost: Improve vhost_get_avail_head()
> config: i386-randconfig-141-20240426 (https://download.01.org/0day-ci/archive/20240426/202404260448.g7F06v7M-lkp@intel.com/config)
> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202404260448.g7F06v7M-lkp@intel.com/
>
> smatch warnings:
> drivers/vhost/vhost.c:2614 vhost_get_vq_desc() warn: unsigned 'head' is never less than zero.
> drivers/vhost/vhost.c:2614 vhost_get_vq_desc() warn: error code type promoted to positive: 'head'
>
> vim +/head +2614 drivers/vhost/vhost.c
>
> 2581
> 2582 /* This looks in the virtqueue and for the first available buffer, and converts
> 2583 * it to an iovec for convenient access. Since descriptors consist of some
> 2584 * number of output then some number of input descriptors, it's actually two
> 2585 * iovecs, but we pack them into one and note how many of each there were.
> 2586 *
> 2587 * This function returns the descriptor number found, or vq->num (which is
> 2588 * never a valid descriptor number) if none was found. A negative code is
> 2589 * returned on error. */
> 2590 int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> 2591 struct iovec iov[], unsigned int iov_size,
> 2592 unsigned int *out_num, unsigned int *in_num,
> 2593 struct vhost_log *log, unsigned int *log_num)
> 2594 {
> 2595 struct vring_desc desc;
> 2596 unsigned int i, head, found = 0;
> 2597 int ret, access;
> 2598
> 2599 if (vq->avail_idx == vq->last_avail_idx) {
> 2600 ret = vhost_get_avail_idx(vq);
> 2601 if (unlikely(ret))
> 2602 return ret;
> 2603
> 2604 /* If there's nothing new since last we looked, return
> 2605 * invalid.
> 2606 */
> 2607 if (vq->avail_idx == vq->last_avail_idx)
> 2608 return vq->num;
> 2609 }
> 2610
> 2611 /* Grab the next descriptor number they're advertising, and increment
> 2612 * the index we've seen. */
> 2613 head = vhost_get_avail_head(vq);
>> 2614 if (unlikely(head < 0))
> 2615 return head;
Thanks for the report. @head needs to be 'int' instead of 'unsigned int'
so that it can hold the error number from vhost_get_avail_head(). I would
give it more time to see if there are other review comments before I revise
it to fix it up.
Thanks,
Gavin
next prev parent reply other threads:[~2024-04-25 22:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 3:24 [PATCH 0/4] vhost: Cleanup Gavin Shan
2024-04-23 3:24 ` [PATCH 1/4] vhost: Drop variable last_avail_idx in vhost_get_vq_desc() Gavin Shan
2024-04-23 3:24 ` [PATCH 2/4] vhost: Improve vhost_get_avail_idx() with smp_rmb() Gavin Shan
2024-04-23 3:24 ` [PATCH 3/4] vhost: Improve vhost_get_avail_head() Gavin Shan
2024-04-25 20:42 ` kernel test robot
2024-04-25 22:45 ` Gavin Shan [this message]
2024-04-23 3:24 ` [PATCH 4/4] vhost: Reformat vhost_{get, put}_user() Gavin Shan
2024-04-29 7:02 ` [PATCH 0/4] vhost: Cleanup Michael S. Tsirkin
2024-04-29 10:17 ` Gavin Shan
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=9237d933-406d-4120-a5fd-34a238f2ccdb@redhat.com \
--to=gshan@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mst@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=shan.gavin@gmail.com \
--cc=virtualization@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox