* [PATCH] input: signedness bug in cma3000_thread_irq()
@ 2011-12-12 6:49 Xi Wang
2011-12-12 7:42 ` Dmitry Torokhov
2011-12-15 2:27 ` Valdis.Kletnieks
0 siblings, 2 replies; 7+ messages in thread
From: Xi Wang @ 2011-12-12 6:49 UTC (permalink / raw)
To: Dmitry Torokhov, Paul Gortmaker; +Cc: linux-input, linux-kernel, Xi Wang
The error check (intr_status < 0) didn't work because intr_status is
a u8. Change its type to signed int.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
drivers/input/misc/cma3000_d0x.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/cma3000_d0x.c b/drivers/input/misc/cma3000_d0x.c
index 80793f1..06517e6 100644
--- a/drivers/input/misc/cma3000_d0x.c
+++ b/drivers/input/misc/cma3000_d0x.c
@@ -115,8 +115,8 @@ static void decode_mg(struct cma3000_accl_data *data, int *datax,
static irqreturn_t cma3000_thread_irq(int irq, void *dev_id)
{
struct cma3000_accl_data *data = dev_id;
- int datax, datay, dataz;
- u8 ctrl, mode, range, intr_status;
+ int datax, datay, dataz, intr_status;
+ u8 ctrl, mode, range;
intr_status = CMA3000_READ(data, CMA3000_INTSTATUS, "interrupt status");
if (intr_status < 0)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] input: signedness bug in cma3000_thread_irq()
2011-12-12 6:49 [PATCH] input: signedness bug in cma3000_thread_irq() Xi Wang
@ 2011-12-12 7:42 ` Dmitry Torokhov
2011-12-15 2:27 ` Valdis.Kletnieks
1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2011-12-12 7:42 UTC (permalink / raw)
To: Xi Wang; +Cc: Paul Gortmaker, linux-input, linux-kernel
On Mon, Dec 12, 2011 at 01:49:26AM -0500, Xi Wang wrote:
> The error check (intr_status < 0) didn't work because intr_status is
> a u8. Change its type to signed int.
>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: signedness bug in cma3000_thread_irq()
2011-12-12 6:49 [PATCH] input: signedness bug in cma3000_thread_irq() Xi Wang
2011-12-12 7:42 ` Dmitry Torokhov
@ 2011-12-15 2:27 ` Valdis.Kletnieks
2011-12-15 2:35 ` Xi Wang
1 sibling, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2011-12-15 2:27 UTC (permalink / raw)
To: Xi Wang; +Cc: Dmitry Torokhov, Paul Gortmaker, linux-input, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 511 bytes --]
On Mon, 12 Dec 2011 01:49:26 EST, Xi Wang said:
> The error check (intr_status < 0) didn't work because intr_status is
> a u8. Change its type to signed int.
>
> Signed-off-by: Xi Wang <xi.wang@gmail.com>
> ---
> drivers/input/misc/cma3000_d0x.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/misc/cma3000_d0x.c b/drivers/input/misc/cma3000_d0x.c
That will fix the signed/unsigned issue. However, was there a reason
the field was an 8-bit-wide to begin with?
[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: signedness bug in cma3000_thread_irq()
2011-12-15 2:27 ` Valdis.Kletnieks
@ 2011-12-15 2:35 ` Xi Wang
2011-12-15 3:21 ` Valdis.Kletnieks
0 siblings, 1 reply; 7+ messages in thread
From: Xi Wang @ 2011-12-15 2:35 UTC (permalink / raw)
To: Valdis.Kletnieks
Cc: Dmitry Torokhov, Paul Gortmaker, linux-input, linux-kernel
On Dec 14, 2011, at 9:27 PM, Valdis.Kletnieks@vt.edu wrote:
> That will fix the signed/unsigned issue. However, was there a reason
> the field was an 8-bit-wide to begin with?
Which field? The ->read() function pointer?
- xi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: signedness bug in cma3000_thread_irq()
2011-12-15 2:35 ` Xi Wang
@ 2011-12-15 3:21 ` Valdis.Kletnieks
2011-12-15 22:17 ` Xi Wang
0 siblings, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2011-12-15 3:21 UTC (permalink / raw)
To: Xi Wang; +Cc: Dmitry Torokhov, Paul Gortmaker, linux-input, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
On Wed, 14 Dec 2011 21:35:22 EST, Xi Wang said:
> On Dec 14, 2011, at 9:27 PM, Valdis.Kletnieks@vt.edu wrote:
> > That will fix the signed/unsigned issue. However, was there a reason
> > the field was an 8-bit-wide to begin with?
>
> Which field? The ->read() function pointer?
No, the variable that used to be a u8 - was it 8 bits wide for a reason?
[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: signedness bug in cma3000_thread_irq()
2011-12-15 3:21 ` Valdis.Kletnieks
@ 2011-12-15 22:17 ` Xi Wang
2011-12-22 17:50 ` Dmitry Torokhov
0 siblings, 1 reply; 7+ messages in thread
From: Xi Wang @ 2011-12-15 22:17 UTC (permalink / raw)
To: Valdis.Kletnieks
Cc: Dmitry Torokhov, Paul Gortmaker, linux-input, linux-kernel
On Dec 14, 2011, at 10:21 PM, Valdis.Kletnieks@vt.edu wrote:
> No, the variable that used to be a u8 - was it 8 bits wide for a reason?
The return value of CMA3000_READ? I don't see any particular reason.
- xi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: signedness bug in cma3000_thread_irq()
2011-12-15 22:17 ` Xi Wang
@ 2011-12-22 17:50 ` Dmitry Torokhov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2011-12-22 17:50 UTC (permalink / raw)
To: Xi Wang; +Cc: Valdis.Kletnieks, Paul Gortmaker, linux-input, linux-kernel
On Thu, Dec 15, 2011 at 05:17:02PM -0500, Xi Wang wrote:
> On Dec 14, 2011, at 10:21 PM, Valdis.Kletnieks@vt.edu wrote:
> > No, the variable that used to be a u8 - was it 8 bits wide for a reason?
>
> The return value of CMA3000_READ? I don't see any particular reason.
>
The data returned by CMA3000_READ() is a byte, so that's the reason (and
I am guessing here) that the author used u8 to store the result,
forgetting that the range was extended to report error conditions.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-22 17:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 6:49 [PATCH] input: signedness bug in cma3000_thread_irq() Xi Wang
2011-12-12 7:42 ` Dmitry Torokhov
2011-12-15 2:27 ` Valdis.Kletnieks
2011-12-15 2:35 ` Xi Wang
2011-12-15 3:21 ` Valdis.Kletnieks
2011-12-15 22:17 ` Xi Wang
2011-12-22 17:50 ` 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).