openwrt/target/linux/brcm2708/patches-4.14/950-0151-vcsm-Fix-obscure-c...

33 lines
1.1 KiB
Diff

From 92b27d4017371772d0370d1e60a32a9f22224c81 Mon Sep 17 00:00:00 2001
From: Sugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>
Date: Mon, 8 Jan 2018 21:07:17 +0900
Subject: [PATCH 151/454] vcsm: Fix obscure conditions
Signed-off-by: Sugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>
---
drivers/char/broadcom/vc_sm/vmcs_sm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c
+++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c
@@ -278,8 +278,8 @@ static unsigned int vmcs_sm_vc_handle_fr
list_for_each_entry(map, &sm_state->map_list, map_list) {
if (map->res_pid != pid)
continue;
- if (!(map->res_addr <= addr &&
- addr < map->res_addr + map->resource->res_size))
+ if (addr < map->res_addr ||
+ addr >= (map->res_addr + map->resource->res_size))
continue;
pr_debug("[%s]: global map %p (pid %u, addr %lx) -> vc-hdl %x (usr-hdl %x)\n",
@@ -1263,7 +1263,7 @@ static int clean_invalid_mem_2d(const vo
size_t i;
void (*op_fn)(const void*, const void*);
- if (block_size <= 0) {
+ if (!block_size) {
pr_err("[%s]: size cannot be 0\n", __func__);
return -EINVAL;
}