Lakka-LibreELEC/projects/NXP/devices/iMX8/patches/linux/0025-LF-3268-drm-cdns-hdmi-fix-Coverity-Issue-11566403.patch

37 lines
1.2 KiB
Diff

From cd49375db5c05acb824fa18ae9d19290073cda08 Mon Sep 17 00:00:00 2001
From: Sandor Yu <Sandor.yu@nxp.com>
Date: Wed, 20 Jan 2021 11:07:32 +0800
Subject: [PATCH 25/49] LF-3268: drm: cdns-hdmi: fix Coverity Issue: 11566403
Check return value to fix Coverity Issue: 11566403.
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 df8ac87b3a54..28193178140f 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
@@ -119,10 +119,13 @@ ssize_t HDCPTX_Status_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;
if (count == 2) {
- sscanf(buf, "%d", &value);
+ ret = sscanf(buf, "%d", &value);
+ if (ret != 1)
+ return -EINVAL;
+
if ((value >= HDCP_STATE_NO_AKSV) && (value <= HDCP_STATE_AUTH_FAILED)) {
mhdp->hdcp.state = value;
return count;
--
2.29.2