]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: vidconsole: Fix null dereference of ops->measure
authorBin Meng <bmeng@tinylab.org>
Thu, 3 Aug 2023 09:32:41 +0000 (17:32 +0800)
committerAnatolij Gustschin <agust@denx.de>
Sun, 13 Aug 2023 21:08:15 +0000 (23:08 +0200)
At present vidconsole_measure() tests ops->select_font before calling
ops->measure, which would result in a null dereference when the console
driver provides no ops for measure.

Fixes: b828ed7d7929 ("console: Allow measuring the bounding box of text")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/video/vidconsole-uclass.c

index 05f9304780967648ee67b38695278bb59800b1b6..b5b3b6625902744d2dd853de24716d9e5015c5e8 100644 (file)
@@ -603,7 +603,7 @@ int vidconsole_measure(struct udevice *dev, const char *name, uint size,
        struct vidconsole_ops *ops = vidconsole_get_ops(dev);
        int ret;
 
-       if (ops->select_font) {
+       if (ops->measure) {
                ret = ops->measure(dev, name, size, text, bbox);
                if (ret != -ENOSYS)
                        return ret;