* [patch 1/3] Input: cyttsp4 - silence shift wrap warning
@ 2013-07-02 21:40 Dan Carpenter
2013-07-03 3:37 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-07-02 21:40 UTC (permalink / raw)
To: Javier Martinez Canillas, Ferruh Yigit
Cc: Dmitry Torokhov, linux-input, kernel-janitors
"*max" is a size_t (long) type but "1" is an int so static checkers
complain that the shift could wrap.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index 963da05..7aa4a34 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -153,7 +153,7 @@ static int cyttsp4_hw_reset(struct cyttsp4 *cd)
*/
static int cyttsp4_bits_2_bytes(unsigned int nbits, size_t *max)
{
- *max = 1 << nbits;
+ *max = 1UL << nbits;
return (nbits + 7) / 8;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch 1/3] Input: cyttsp4 - silence shift wrap warning
2013-07-02 21:40 [patch 1/3] Input: cyttsp4 - silence shift wrap warning Dan Carpenter
@ 2013-07-03 3:37 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2013-07-03 3:37 UTC (permalink / raw)
To: Dan Carpenter
Cc: Javier Martinez Canillas, Ferruh Yigit, linux-input,
kernel-janitors
On Wed, Jul 03, 2013 at 12:40:19AM +0300, Dan Carpenter wrote:
> "*max" is a size_t (long) type but "1" is an int so static checkers
> complain that the shift could wrap.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied all 3, thank you Dan.
>
> diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
> index 963da05..7aa4a34 100644
> --- a/drivers/input/touchscreen/cyttsp4_core.c
> +++ b/drivers/input/touchscreen/cyttsp4_core.c
> @@ -153,7 +153,7 @@ static int cyttsp4_hw_reset(struct cyttsp4 *cd)
> */
> static int cyttsp4_bits_2_bytes(unsigned int nbits, size_t *max)
> {
> - *max = 1 << nbits;
> + *max = 1UL << nbits;
> return (nbits + 7) / 8;
> }
>
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-03 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 21:40 [patch 1/3] Input: cyttsp4 - silence shift wrap warning Dan Carpenter
2013-07-03 3:37 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox