Import Ubuntu patch to fix the allocation check
Stephen Kitt
4 years ago
|
0 |
ddcci-driver-linux (0.3.2-2) UNRELEASED; urgency=medium
|
|
1 |
|
|
2 |
* Fix incorrect check on null pointer after a kzalloc (LP: #1833578)
|
|
3 |
- checking if pointer device is null rather than buffer.
|
|
4 |
|
|
5 |
-- Colin Ian King <colin.king@canonical.com> Thu, 20 Jun 2019 17:04:11 +0100
|
|
6 |
|
0 | 7 |
ddcci-driver-linux (0.3.2-1) unstable; urgency=medium
|
1 | 8 |
|
2 | 9 |
* New upstream release.
|
|
0 |
From 152239bae52698f02523da11272c77cb87b75629 Mon Sep 17 00:00:00 2001
|
|
1 |
From: Colin Ian King <colin.king@canonical.com>
|
|
2 |
Date: Wed, 12 Jun 2019 10:42:39 +0100
|
|
3 |
Subject: [PATCH] Fix incorrect check on null pointer after a kzalloc
|
|
4 |
Content-Type: text/plain; charset="utf-8"
|
|
5 |
Content-Transfer-Encoding: 8bit
|
|
6 |
|
|
7 |
Currently device is being allocated but buffer is being used to
|
|
8 |
check for a failed allocation. Fix this by checking if device
|
|
9 |
is null rather than buffer.
|
|
10 |
|
|
11 |
Addresses-Coverity: ("Logically dead code")
|
|
12 |
Signed-off-by: Colin Ian King <colin.king@canonical.com>
|
|
13 |
---
|
|
14 |
ddcci/ddcci.c | 2 +-
|
|
15 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
16 |
|
|
17 |
diff --git a/ddcci/ddcci.c b/ddcci/ddcci.c
|
|
18 |
index edeafc6..a8b572e 100644
|
|
19 |
--- a/ddcci/ddcci.c
|
|
20 |
+++ b/ddcci/ddcci.c
|
|
21 |
@@ -1333,7 +1333,7 @@ static int ddcci_detect_device(struct i2c_client *client, unsigned char addr,
|
|
22 |
|
|
23 |
/* Allocate device struct */
|
|
24 |
device = kzalloc(sizeof(struct ddcci_device), GFP_KERNEL);
|
|
25 |
- if (!buffer) {
|
|
26 |
+ if (!device) {
|
|
27 |
ret = -ENOMEM;
|
|
28 |
goto end;
|
|
29 |
}
|
|
30 |
--
|
|
31 |
2.20.1
|
|
32 |
|
|
0 |
0001-Fix-incorrect-check-on-null-pointer-after-a-kzalloc.patch
|