From 2bc5fc8909ea44b795f0ef83f85e3269369bb4a9 Mon Sep 17 00:00:00 2001 From: Yingyuan Zhu Date: Wed, 29 Aug 2018 18:51:32 +0800 Subject: [PATCH] touchscreen: goodix_gt1x: fix coverity warning PD#172714: touchscreen: goodix_gt1x: fix coverity warning There is no judgment about whether it is null before using the pointer. This causes "Untrusted value as argument". Change-Id: I147b89e9a96cddf4bdc3c42753bd165b6b802065 Signed-off-by: Yingyuan Zhu --- drivers/amlogic/input/touchscreen/goodix_gt1x/gt1x_extents.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/input/touchscreen/goodix_gt1x/gt1x_extents.c b/drivers/amlogic/input/touchscreen/goodix_gt1x/gt1x_extents.c index 417421a00e94..4279e470bbe9 100644 --- a/drivers/amlogic/input/touchscreen/goodix_gt1x/gt1x_extents.c +++ b/drivers/amlogic/input/touchscreen/goodix_gt1x/gt1x_extents.c @@ -665,7 +665,7 @@ static long gt1x_ioctl(struct file *file, unsigned int cmd, unsigned long arg) u32 value = 0; s32 ret = 0; //the initial value must be 0 u8 *data = NULL; - int cnt = 30; + int cnt = 30; /* Blocking when firmwaer updating */ while (cnt-- && update_info.status) { @@ -696,6 +696,8 @@ static long gt1x_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } else { value = (u32) arg; } + if (!data) + return -1; switch (cmd & NEGLECT_SIZE_MASK) { case IO_GET_VERISON: