[PATCH] video: vidconsole: Fix null dereference of ops->measure

Bin Meng bmeng at tinylab.org
Thu Aug 3 11:32:41 CEST 2023


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 at tinylab.org>
---

 drivers/video/vidconsole-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 05f9304780..b5b3b66259 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -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;
-- 
2.25.1



More information about the U-Boot mailing list