]> www.infradead.org Git - users/dwmw2/linux.git/commit
fbdev: hyperv_fb: fix uninitialized local variable use
authorArnd Bergmann <arnd@arndb.de>
Wed, 8 Nov 2023 14:58:13 +0000 (15:58 +0100)
committerHelge Deller <deller@gmx.de>
Fri, 10 Nov 2023 06:34:19 +0000 (07:34 +0100)
commitcca202a5e59578247cd7f0496056884f5c9cc338
tree98185ef4113daaf03fbed807a4a355c2e60fbb5b
parent2e2389ca5d7efd2f029b138d78e38200d5ba125b
fbdev: hyperv_fb: fix uninitialized local variable use

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>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/hyperv_fb.c