All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH V2 04/12] virtio_console: validate max_nr_ports before trying to use it
Date: Wed, 13 Oct 2021 05:09:14 +0800	[thread overview]
Message-ID: <202110130542.zmHunyOJ-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211012065227.9953-5-jasowang@redhat.com>
References: <20211012065227.9953-5-jasowang@redhat.com>
TO: Jason Wang <jasowang@redhat.com>
TO: mst(a)redhat.com
TO: jasowang(a)redhat.com
CC: virtualization(a)lists.linux-foundation.org
CC: linux-kernel(a)vger.kernel.org
CC: f.hetzelt(a)tu-berlin.de
CC: david.kaplan(a)amd.com
CC: konrad.wilk(a)oracle.com
CC: Amit Shah <amit@kernel.org>

Hi Jason,

I love your patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on char-misc/char-misc-testing mst-vhost/linux-next linus/master v5.15-rc5 next-20211012]
[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]

url:    https://github.com/0day-ci/linux/commits/Jason-Wang/More-virtio-hardening/20211012-145541
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: x86_64-randconfig-m001-20211012 (attached as .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>

New smatch warnings:
drivers/char/virtio_console.c:2008 virtcons_validate() error: uninitialized symbol 'max_nr_ports'.

Old smatch warnings:
drivers/char/virtio_console.c:1604 handle_control_message() error: we previously assumed 'port' could be null (see line 1572)

vim +/max_nr_ports +2008 drivers/char/virtio_console.c

aa44ec867030a72 Michael S. Tsirkin 2018-04-20  1982  
83d05ea1530de43 Jason Wang         2021-10-12  1983  static int virtcons_validate(struct virtio_device *vdev)
83d05ea1530de43 Jason Wang         2021-10-12  1984  {
96703132f927fa0 Jason Wang         2021-10-12  1985  	u32 max_nr_ports;
96703132f927fa0 Jason Wang         2021-10-12  1986  
83d05ea1530de43 Jason Wang         2021-10-12  1987  	if (is_rproc_serial(vdev)) {
83d05ea1530de43 Jason Wang         2021-10-12  1988  		/* Don't test F_SIZE at all if we're rproc: not a
83d05ea1530de43 Jason Wang         2021-10-12  1989  		 * valid feature! */
83d05ea1530de43 Jason Wang         2021-10-12  1990  		__virtio_clear_bit(vdev, VIRTIO_CONSOLE_F_SIZE);
83d05ea1530de43 Jason Wang         2021-10-12  1991  		/* Don't test MULTIPORT at all if we're rproc: not a
83d05ea1530de43 Jason Wang         2021-10-12  1992  		 * valid feature! */
83d05ea1530de43 Jason Wang         2021-10-12  1993  		__virtio_clear_bit(vdev, VIRTIO_CONSOLE_F_MULTIPORT);
83d05ea1530de43 Jason Wang         2021-10-12  1994  	}
83d05ea1530de43 Jason Wang         2021-10-12  1995  
83d05ea1530de43 Jason Wang         2021-10-12  1996  	/* We only need a config space if features are offered */
83d05ea1530de43 Jason Wang         2021-10-12  1997  	if (!vdev->config->get &&
83d05ea1530de43 Jason Wang         2021-10-12  1998  	    (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)
83d05ea1530de43 Jason Wang         2021-10-12  1999  	     || virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT))) {
83d05ea1530de43 Jason Wang         2021-10-12  2000  		dev_err(&vdev->dev, "%s failure: config access disabled\n",
83d05ea1530de43 Jason Wang         2021-10-12  2001  			__func__);
83d05ea1530de43 Jason Wang         2021-10-12  2002  		return -EINVAL;
83d05ea1530de43 Jason Wang         2021-10-12  2003  	}
83d05ea1530de43 Jason Wang         2021-10-12  2004  
96703132f927fa0 Jason Wang         2021-10-12  2005  	if (virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
96703132f927fa0 Jason Wang         2021-10-12  2006  				 struct virtio_console_config, max_nr_ports,
96703132f927fa0 Jason Wang         2021-10-12  2007  				 &max_nr_ports) == 0) {
96703132f927fa0 Jason Wang         2021-10-12 @2008  		if (max_nr_ports == 0 || max_nr_ports > VIRTCONS_MAX_PORTS)
96703132f927fa0 Jason Wang         2021-10-12  2009  			__virtio_clear_bit(vdev, VIRTIO_CONSOLE_F_MULTIPORT);
96703132f927fa0 Jason Wang         2021-10-12  2010  	}
96703132f927fa0 Jason Wang         2021-10-12  2011  
83d05ea1530de43 Jason Wang         2021-10-12  2012  	return 0;
83d05ea1530de43 Jason Wang         2021-10-12  2013  }
83d05ea1530de43 Jason Wang         2021-10-12  2014  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27747 bytes --]

             reply	other threads:[~2021-10-12 21:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 21:09 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-12  6:52 [PATCH V2 00/12] More virtio hardening Jason Wang
2021-10-12  6:52 ` [PATCH V2 04/12] virtio_console: validate max_nr_ports before trying to use it Jason Wang
2021-10-12  6:52   ` Jason Wang

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=202110130542.zmHunyOJ-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.