Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | [PATCH] return 0 if distance_table is NULL |
| 2 | |
| 3 | Upstream-Status: Pending |
| 4 | |
| 5 | read_distance_table() maybe return 0, but distance_table is not set, |
| 6 | if distance_table is used, and will lead to SEGFAULT |
| 7 | |
| 8 | Signed-off-by: Roy Li <rongqing.li@windriver.com> |
| 9 | --- |
| 10 | distance.c | 2 ++ |
| 11 | 1 file changed, 2 insertions(+) |
| 12 | |
| 13 | diff --git a/distance.c b/distance.c |
| 14 | index 4a26972..c6ca021 100755 |
| 15 | --- a/distance.c |
| 16 | +++ b/distance.c |
| 17 | @@ -113,6 +113,8 @@ int numa_distance(int a, int b) |
| 18 | int err = read_distance_table(); |
| 19 | if (err < 0) |
| 20 | return 0; |
| 21 | + if (!distance_table) |
| 22 | + return 0; |
| 23 | } |
| 24 | return distance_table[a * distance_numnodes + b]; |
| 25 | } |
| 26 | -- |
| 27 | 1.7.10.4 |
| 28 | |