Skip to content

Commit cca202a

Browse files
arndbhdeller
authored andcommitted
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 <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Fixes: a07b50d ("hyperv: avoid dependency on screen_info") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 2e2389c commit cca202a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/video/fbdev/hyperv_fb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
10131013
} else if (IS_ENABLED(CONFIG_SYSFB)) {
10141014
base = screen_info.lfb_base;
10151015
size = screen_info.lfb_size;
1016+
} else {
1017+
goto err1;
10161018
}
10171019

10181020
/*

0 commit comments

Comments
 (0)