kdrive/fbdev: Fix uninitialized variable when switching vt's

When rapidly switching vt's, it can happen that shadow tries to
draw to the screen before it's initialized.
In that case, we return NULL, and we should also return a zero size,
because shadow doesn't check for NULL.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111 2026-01-22 23:32:12 +02:00 committed by Enrico Weigelt
parent 43232e4f09
commit 76356395e7

View File

@ -318,8 +318,10 @@ fbdevWindowLinear(ScreenPtr pScreen,
KdScreenPriv(pScreen);
FbdevPriv *priv = pScreenPriv->card->driver;
if (!pScreenPriv->enabled)
return 0;
if (!pScreenPriv->enabled) {
*size = 0;
return NULL;
}
*size = priv->fix.line_length;
return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
}
@ -332,8 +334,10 @@ fbdevWindowAfb(ScreenPtr pScreen,
KdScreenPriv(pScreen);
FbdevPriv *priv = pScreenPriv->card->driver;
if (!pScreenPriv->enabled)
return 0;
if (!pScreenPriv->enabled) {
*size = 0;
return NULL;
}
/* offset to next plane */
*size = priv->var.yres_virtual * priv->fix.line_length;
return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;