Lakka-LibreELEC/projects/NXP/devices/iMX8/patches/linux/0024-LF-3269-drm-cdns-hdmi-fix-coverity-Issue-11566404.patch

36 lines
1.1 KiB
Diff

From 2812d071eb348d903620f7ebadaf848024b3c672 Mon Sep 17 00:00:00 2001
From: Sandor Yu <Sandor.yu@nxp.com>
Date: Wed, 20 Jan 2021 11:04:41 +0800
Subject: [PATCH 24/49] LF-3269: drm: cdns-hdmi: fix coverity Issue: 11566404
Check return value to fix coverity Issue: 11566404.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
---
drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
index 2300c3d8a91d..df8ac87b3a54 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
@@ -59,9 +59,12 @@ static ssize_t HDCPTX_Version_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct cdns_mhdp_device *mhdp = dev_get_drvdata(dev);
- int value;
+ int value, ret;
+
+ ret = sscanf(buf, "%d", &value);
+ if (ret != 1)
+ return -EINVAL;
- sscanf(buf, "%d", &value);
if (value == 2)
mhdp->hdcp.config = 2;
else if (value == 1)
--
2.29.2