* [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity
@ 2014-08-11 18:03 Dmitry Torokhov
2014-08-12 16:38 ` Nick Dyer
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2014-08-11 18:03 UTC (permalink / raw)
To: linux-input
Cc: Nick Dyer, Yufeng Shen, Benson Leung, Stephen Warren,
linux-kernel
This should fix the following issues reported by Coverity:
*** CID 1230625: Logically dead code (DEADCODE)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1692 in mxt_initialize()
*** CID 1230627: Missing break in switch (MISSING_BREAK)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1436 in mxt_get_object_table()
*** CID 1230629: Out-of-bounds write (OVERRUN)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1267 in mxt_update_cfg()
*** CID 1230632: Unused pointer value (UNUSED_VALUE)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1211 in mxt_update_cfg()
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index bbaf3ff..db178ed 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1098,8 +1098,12 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data,
/* Skip object */
for (i = 0; i < size; i++) {
ret = sscanf(cfg->data + data_pos, "%hhx%n",
- &val,
- &offset);
+ &val, &offset);
+ if (ret != 1) {
+ dev_err(dev, "Bad format in T%d at %d\n",
+ type, i);
+ return -EINVAL;
+ }
data_pos += offset;
}
continue;
@@ -1139,7 +1143,8 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data,
&val,
&offset);
if (ret != 1) {
- dev_err(dev, "Bad format in T%d\n", type);
+ dev_err(dev, "Bad format in T%d at %d\n",
+ type, i);
return -EINVAL;
}
data_pos += offset;
@@ -1149,8 +1154,7 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data,
byte_offset = reg + i - cfg_start_ofs;
- if (byte_offset >= 0 &&
- byte_offset <= config_mem_size) {
+ if (byte_offset >= 0 && byte_offset < config_mem_size) {
*(config_mem + byte_offset) = val;
} else {
dev_err(dev, "Bad object: reg:%d, T%d, ofs=%d\n",
@@ -1454,6 +1458,7 @@ static int mxt_get_object_table(struct mxt_data *data)
data->T5_msg_size = mxt_obj_size(object) - 1;
}
data->T5_address = object->start_address;
+ break;
case MXT_GEN_COMMAND_T6:
data->T6_reportid = min_id;
data->T6_address = object->start_address;
@@ -1707,7 +1712,7 @@ static int mxt_initialize(struct mxt_data *data)
return error;
}
- mxt_acquire_irq(data);
+ error = mxt_acquire_irq(data);
if (error)
goto err_free_object_table;
--
2.0.0.526.g5318336
--
Dmitry
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity
2014-08-11 18:03 [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity Dmitry Torokhov
@ 2014-08-12 16:38 ` Nick Dyer
2014-08-12 16:41 ` Stephen Warren
0 siblings, 1 reply; 5+ messages in thread
From: Nick Dyer @ 2014-08-12 16:38 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input
Cc: Yufeng Shen, Benson Leung, Stephen Warren, linux-kernel
On 11/08/14 19:03, Dmitry Torokhov wrote:
> This should fix the following issues reported by Coverity:
>
> *** CID 1230625: Logically dead code (DEADCODE)
> /drivers/input/touchscreen/atmel_mxt_ts.c: 1692 in mxt_initialize()
>
> *** CID 1230627: Missing break in switch (MISSING_BREAK)
> /drivers/input/touchscreen/atmel_mxt_ts.c: 1436 in mxt_get_object_table()
>
> *** CID 1230629: Out-of-bounds write (OVERRUN)
> /drivers/input/touchscreen/atmel_mxt_ts.c: 1267 in mxt_update_cfg()
>
> *** CID 1230632: Unused pointer value (UNUSED_VALUE)
> /drivers/input/touchscreen/atmel_mxt_ts.c: 1211 in mxt_update_cfg()
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
I've reviewed these changes and they look correct to me. Apologies that
they slipped through, most of it is bad merging on my part I think.
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity
2014-08-12 16:38 ` Nick Dyer
@ 2014-08-12 16:41 ` Stephen Warren
2014-08-12 21:08 ` Nick Dyer
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2014-08-12 16:41 UTC (permalink / raw)
To: Nick Dyer
Cc: Dmitry Torokhov, linux-input, Yufeng Shen, Benson Leung,
Stephen Warren, linux-kernel
On 08/12/2014 10:38 AM, Nick Dyer wrote:
> On 11/08/14 19:03, Dmitry Torokhov wrote:
>> This should fix the following issues reported by Coverity:
>>
>> *** CID 1230625: Logically dead code (DEADCODE)
>> /drivers/input/touchscreen/atmel_mxt_ts.c: 1692 in mxt_initialize()
>>
>> *** CID 1230627: Missing break in switch (MISSING_BREAK)
>> /drivers/input/touchscreen/atmel_mxt_ts.c: 1436 in mxt_get_object_table()
>>
>> *** CID 1230629: Out-of-bounds write (OVERRUN)
>> /drivers/input/touchscreen/atmel_mxt_ts.c: 1267 in mxt_update_cfg()
>>
>> *** CID 1230632: Unused pointer value (UNUSED_VALUE)
>> /drivers/input/touchscreen/atmel_mxt_ts.c: 1211 in mxt_update_cfg()
>>
>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> I've reviewed these changes and they look correct to me. Apologies that
> they slipped through, most of it is bad merging on my part I think.
>
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Don't you mean Acked-by or Reviewed-by?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity
2014-08-12 16:41 ` Stephen Warren
@ 2014-08-12 21:08 ` Nick Dyer
2014-08-13 16:14 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Nick Dyer @ 2014-08-12 21:08 UTC (permalink / raw)
To: Stephen Warren
Cc: Dmitry Torokhov, linux-input, Yufeng Shen, Benson Leung,
Stephen Warren, linux-kernel
On 12/08/14 17:41, Stephen Warren wrote:
>> I've reviewed these changes and they look correct to me. Apologies that
>> they slipped through, most of it is bad merging on my part I think.
>>
>> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
>
> Don't you mean Acked-by or Reviewed-by?
You are right, Acked-by is probably more appropriate in this case.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity
2014-08-12 21:08 ` Nick Dyer
@ 2014-08-13 16:14 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2014-08-13 16:14 UTC (permalink / raw)
To: Nick Dyer
Cc: Stephen Warren, linux-input, Yufeng Shen, Benson Leung,
Stephen Warren, linux-kernel
On Tue, Aug 12, 2014 at 10:08:48PM +0100, Nick Dyer wrote:
> On 12/08/14 17:41, Stephen Warren wrote:
> >> I've reviewed these changes and they look correct to me. Apologies that
> >> they slipped through, most of it is bad merging on my part I think.
> >>
> >> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> >
> > Don't you mean Acked-by or Reviewed-by?
>
> You are right, Acked-by is probably more appropriate in this case.
OK, I put you as "asked-by" then.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-13 16:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-11 18:03 [PATCH] Input: atmel_mxt_ts - fix a few issues reported by Coverity Dmitry Torokhov
2014-08-12 16:38 ` Nick Dyer
2014-08-12 16:41 ` Stephen Warren
2014-08-12 21:08 ` Nick Dyer
2014-08-13 16:14 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).