blob: 396397f075e904243e359f58406c73467947091d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
From f5641c2dcb99eb006a2ad359099af05e33e26929 Mon Sep 17 00:00:00 2001
From: Kent Russell <kent.russell@amd.com>
Date: Tue, 21 Nov 2017 11:51:28 -0500
Subject: [PATCH 2868/4131] drm/amdkfd: Fix logic for mem_available
sizeof returns size_t (which is an unsigned int), and mem_available is signed.
signed - unsigned = unsigned in C apparently. Since the result is unsigned,
fix the logic and see if the sizeof(struct) is bigger than mem_available
Change-Id: I672374e77a2c7bbf5260ad7ff161223777fc6265
Signed-off-by: Kent Russell <kent.russell@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 5f597a6..1664ba3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -508,7 +508,7 @@ static int fill_in_pcache(struct crat_subtype_cache *pcache,
int first_active_cu;
/* First check if enough memory is available */
- if (mem_available - sizeof(struct crat_subtype_cache) < 0)
+ if (sizeof(struct crat_subtype_cache) > mem_available)
return -ENOMEM;
cu_sibling_map_mask = cu_bitmask;
--
2.7.4
|