diff mbox series

Input: wacom_w8001 - Allocate additional space for 'phys'

Message ID 20190816184927.24525-1-jason.gerecke@wacom.com (mailing list archive)
State Mainlined
Commit 2da9d2b5b9d64cf5228dd3fb4d1220ff3fec8440
Headers show
Series Input: wacom_w8001 - Allocate additional space for 'phys' | expand

Commit Message

Gerecke, Jason Aug. 16, 2019, 6:49 p.m. UTC
GCC warns that the output of our call to 'snprintf' in 'w8001_connect'
may be truncated since both 'serio->phys' and 'w8001->phys' are 32 bytes
in length. Increase the amount of space allocated for the latter to
compensate.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
 drivers/input/touchscreen/wacom_w8001.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov Aug. 21, 2019, 5:10 a.m. UTC | #1
On Fri, Aug 16, 2019 at 11:49:27AM -0700, Jason Gerecke wrote:
> GCC warns that the output of our call to 'snprintf' in 'w8001_connect'
> may be truncated since both 'serio->phys' and 'w8001->phys' are 32 bytes
> in length. Increase the amount of space allocated for the latter to
> compensate.
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/wacom_w8001.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
> index 3715d1eace92..691285ace228 100644
> --- a/drivers/input/touchscreen/wacom_w8001.c
> +++ b/drivers/input/touchscreen/wacom_w8001.c
> @@ -27,6 +27,8 @@ MODULE_AUTHOR("Jaya Kumar <jayakumar.lkml@gmail.com>");
>  MODULE_DESCRIPTION(DRIVER_DESC);
>  MODULE_LICENSE("GPL");
>  
> +#define W8001_MAX_PHYS		42
> +
>  #define W8001_MAX_LENGTH	13
>  #define W8001_LEAD_MASK		0x80
>  #define W8001_LEAD_BYTE		0x80
> @@ -89,7 +91,7 @@ struct w8001 {
>  	unsigned char response_type;
>  	unsigned char response[W8001_MAX_LENGTH];
>  	unsigned char data[W8001_MAX_LENGTH];
> -	char phys[32];
> +	char phys[W8001_MAX_PHYS];
>  	int type;
>  	unsigned int pktlen;
>  	u16 max_touch_x;
> -- 
> 2.22.1
>
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
index 3715d1eace92..691285ace228 100644
--- a/drivers/input/touchscreen/wacom_w8001.c
+++ b/drivers/input/touchscreen/wacom_w8001.c
@@ -27,6 +27,8 @@  MODULE_AUTHOR("Jaya Kumar <jayakumar.lkml@gmail.com>");
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
+#define W8001_MAX_PHYS		42
+
 #define W8001_MAX_LENGTH	13
 #define W8001_LEAD_MASK		0x80
 #define W8001_LEAD_BYTE		0x80
@@ -89,7 +91,7 @@  struct w8001 {
 	unsigned char response_type;
 	unsigned char response[W8001_MAX_LENGTH];
 	unsigned char data[W8001_MAX_LENGTH];
-	char phys[32];
+	char phys[W8001_MAX_PHYS];
 	int type;
 	unsigned int pktlen;
 	u16 max_touch_x;