Linux-HyperV Archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Arnd Bergmann <arnd@kernel.org>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Arnd Bergmann <arnd@arndb.de>
Cc: kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Michael Kelley <mikelley@microsoft.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Dawei Li <set_pte_at@outlook.com>,
	linux-hyperv@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fbdev: hyperv_fb: fix uninitialized local variable use
Date: Wed, 8 Nov 2023 16:38:34 +0100	[thread overview]
Message-ID: <a320ae82-24ce-4c0d-bae3-b14e43c1f512@gmx.de> (raw)
In-Reply-To: <20231108145822.3955219-1-arnd@kernel.org>

On 11/8/23 15:58, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When CONFIG_SYSFB is disabled, the hyperv_fb driver can now run into
> undefined behavior on a gen2 VM, as indicated by this smatch warning:
>
> drivers/video/fbdev/hyperv_fb.c:1077 hvfb_getmem() error: uninitialized symbol 'base'.
> drivers/video/fbdev/hyperv_fb.c:1077 hvfb_getmem() error: uninitialized symbol 'size'.
>
> Since there is no way to know the actual framebuffer in this configuration,
> just return an allocation failure here, which should avoid the build
> warning and the undefined behavior.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202311070802.YCpvehaz-lkp@intel.com/
> Fixes: a07b50d80ab6 ("hyperv: avoid dependency on screen_info")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

applied.

Thanks!
Helge


> ---
>   drivers/video/fbdev/hyperv_fb.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
> index bf59daf862fc..a80939fe2ee6 100644
> --- a/drivers/video/fbdev/hyperv_fb.c
> +++ b/drivers/video/fbdev/hyperv_fb.c
> @@ -1013,6 +1013,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
>   	} else if (IS_ENABLED(CONFIG_SYSFB)) {
>   		base = screen_info.lfb_base;
>   		size = screen_info.lfb_size;
> +	} else {
> +		goto err1;
>   	}
>
>   	/*


      reply	other threads:[~2023-11-08 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 14:58 [PATCH] fbdev: hyperv_fb: fix uninitialized local variable use Arnd Bergmann
2023-11-08 15:38 ` Helge Deller [this message]

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=a320ae82-24ce-4c0d-bae3-b14e43c1f512@gmx.de \
    --to=deller@gmx.de \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=decui@microsoft.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=javierm@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kys@microsoft.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mikelley@microsoft.com \
    --cc=set_pte_at@outlook.com \
    --cc=tzimmermann@suse.de \
    --cc=wei.liu@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).