lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210830160207.23936-1-asha.16@itfac.mrt.ac.lk>
Date:   Mon, 30 Aug 2021 21:32:07 +0530
From:   "F.A.Sulaiman" <asha.16@...ac.mrt.ac.lk>
To:     airlied@...hat.com, sean@...rly.run, airlied@...ux.ie,
        daniel@...ll.ch
Cc:     "F.A.Sulaiman" <asha.16@...ac.mrt.ac.lk>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2] GPU:DRM: returning ENOMEM

check the return value and pass the proper error code.

Signed-off-by: F.A. SULAIMAN <asha.16@...ac.mrt.ac.lk>
---
 drivers/gpu/drm/udl/udl_connector.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index cdc1c42e1669..857d2c97ef0e 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -23,7 +23,7 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
 
 	read_buff = kmalloc(2, GFP_KERNEL);
 	if (!read_buff)
-		return -1;
+		return -ENOMEM;
 
 	for (i = 0; i < len; i++) {
 		int bval = (i + block * EDID_LENGTH) << 8;
@@ -31,11 +31,16 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
 				      usb_rcvctrlpipe(udl->udev, 0),
 					  (0x02), (0x80 | (0x02 << 5)), bval,
 					  0xA1, read_buff, 2, HZ);
-		if (ret < 1) {
+		if (ret == 0) {
+			DRM_ERROR("Reading EDID block %d returned empty result\n", i);
+			kfree(read_buff);
+			return -EINVAL;
+		} else if (ret < 0) {
 			DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
 			kfree(read_buff);
-			return -1;
+			return ret;
 		}
+
 		buf[i] = read_buff[1];
 	}
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ