* [PATCHv2 00/23] media: fix all string truncate warnings
@ 2023-09-23 15:20 Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 01/23] media: allegro-dvt: increase buffer size in msg_type_name() Hans Verkuil
` (22 more replies)
0 siblings, 23 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann
This series fixes all string truncate warnings for media drivers.
The first 13 patches have been posted before, the remainder is new.
It's a mix of various techniques, but in the end we are really
just fighting the compiler, and not improving the code.
Anyway, after running my build scripts on this I don't see this
warning anymore.
Regards,
Hans
Hans Verkuil (23):
media: allegro-dvt: increase buffer size in msg_type_name()
media: cadence: increase buffer size in csi2tx_get_resources()
media: atomisp: ia_ccs_debug.c: increase enable_info buffer
media: vivid: avoid integer overflow
media: ipu-bridge: increase sensor_name size
media: cx18: increase in_workq_name size
media: rc: ati_remote: increase mouse_name buffer size
media: cec.h: increase input_phys buffer
media: renesas-ceu: keep input name simple
media: zoran: increase name size
media: v4l2-dev.h: increase struct video_device name size
media: v4l2-subdev.h: increase struct v4l2_subdev name size
media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE
media: vivid: use VIVID_MODULE_NAME to fill bus_info
media: microchip: don't set bus_info
media: rcar_drif: use explicit name for bus_info
media: am437x: don't fill in bus_info
media: atmel: drop bus_info
media: radio-isa: use dev_name to fill in bus_info
media: radio-miropcm20: set bus_info to explicit name
media: verisilicon: replace snprintf with strscpy+strlcat
media: radio-si476x: don't fill in bus_info
drivers/media/i2c/msp3400-driver.c | 2 +-
drivers/media/pci/cx18/cx18-driver.h | 2 +-
drivers/media/pci/zoran/zoran.h | 2 +-
drivers/media/platform/allegro-dvt/allegro-mail.c | 2 +-
drivers/media/platform/cadence/cdns-csi2rx.c | 4 ++--
drivers/media/platform/cadence/cdns-csi2tx.c | 6 +++---
drivers/media/platform/microchip/microchip-isc-base.c | 6 ------
drivers/media/platform/renesas/rcar-isp.c | 2 +-
drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 2 +-
drivers/media/platform/renesas/rcar_drif.c | 3 +--
drivers/media/platform/renesas/renesas-ceu.c | 6 +-----
drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 ----
drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
drivers/media/platform/verisilicon/hantro_drv.c | 5 +++--
drivers/media/radio/radio-isa.c | 2 +-
drivers/media/radio/radio-miropcm20.c | 4 +---
drivers/media/radio/radio-si476x.c | 4 +---
drivers/media/rc/ati_remote.c | 2 +-
drivers/media/test-drivers/vivid/vivid-core.c | 2 +-
drivers/media/test-drivers/vivid/vivid-rds-gen.c | 2 +-
.../media/atomisp/pci/runtime/debug/src/ia_css_debug.c | 2 +-
drivers/staging/media/deprecated/atmel/atmel-isc-base.c | 4 ----
drivers/staging/media/omap4iss/iss_csi2.c | 2 +-
drivers/staging/media/tegra-video/csi.c | 4 ++--
drivers/staging/media/tegra-video/vip.c | 2 +-
include/media/cec.h | 2 +-
include/media/ipu-bridge.h | 2 +-
include/media/v4l2-dev.h | 2 +-
include/media/v4l2-device.h | 4 +---
include/media/v4l2-subdev.h | 4 +---
30 files changed, 33 insertions(+), 59 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCHv2 01/23] media: allegro-dvt: increase buffer size in msg_type_name()
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 02/23] media: cadence: increase buffer size in csi2tx_get_resources() Hans Verkuil
` (21 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Michael Tretter, Arnd Bergmann
Fixes this compile error
drivers/media/platform/allegro-dvt/allegro-mail.c: In function 'msg_type_name':
drivers/media/platform/allegro-dvt/allegro-mail.c:37:48: warning: '%04x' directive output may be truncated writing between 4 and 8 bytes into a region of size 6 [-Wformat-truncation=]
37 | snprintf(buf, sizeof(buf), "(0x%04x)", type);
| ^~~~
drivers/media/platform/allegro-dvt/allegro-mail.c:37:44: note: directive argument in the range [1, 4294967295]
37 | snprintf(buf, sizeof(buf), "(0x%04x)", type);
| ^~~~~~~~~~
drivers/media/platform/allegro-dvt/allegro-mail.c:37:17: note: 'snprintf' output between 9 and 13 bytes into a destination of size 9
37 | snprintf(buf, sizeof(buf), "(0x%04x)", type);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/platform/allegro-dvt/allegro-mail.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/allegro-dvt/allegro-mail.c b/drivers/media/platform/allegro-dvt/allegro-mail.c
index 16effad10746..aadc947a77ae 100644
--- a/drivers/media/platform/allegro-dvt/allegro-mail.c
+++ b/drivers/media/platform/allegro-dvt/allegro-mail.c
@@ -16,7 +16,7 @@
const char *msg_type_name(enum mcu_msg_type type)
{
- static char buf[9];
+ static char buf[13];
switch (type) {
case MCU_MSG_TYPE_INIT:
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 02/23] media: cadence: increase buffer size in csi2tx_get_resources()
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 01/23] media: allegro-dvt: increase buffer size in msg_type_name() Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 03/23] media: atomisp: ia_ccs_debug.c: increase enable_info buffer Hans Verkuil
` (20 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Maxime Ripard, Arnd Bergmann
Fixes this compiler warning:
drivers/media/platform/cadence/cdns-csi2tx.c: In function 'csi2tx_get_resources':
drivers/media/platform/cadence/cdns-csi2tx.c:485:63: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Wformat-truncation=]
485 | snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
| ^~
drivers/media/platform/cadence/cdns-csi2tx.c:485:54: note: directive argument in the range [0, 4294967294]
485 | snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
| ^~~~~~~~~~~~~~~~
drivers/media/platform/cadence/cdns-csi2tx.c:485:17: note: 'snprintf' output between 14 and 23 bytes into a destination of size 16
485 | snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/platform/cadence/cdns-csi2tx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c
index 1e0400b7803e..cbbb77520112 100644
--- a/drivers/media/platform/cadence/cdns-csi2tx.c
+++ b/drivers/media/platform/cadence/cdns-csi2tx.c
@@ -480,7 +480,7 @@ static int csi2tx_get_resources(struct csi2tx_priv *csi2tx,
csi2tx->has_internal_dphy = !!(dev_cfg & CSI2TX_DEVICE_CONFIG_HAS_DPHY);
for (i = 0; i < csi2tx->max_streams; i++) {
- char clk_name[16];
+ char clk_name[23];
snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
csi2tx->pixel_clk[i] = devm_clk_get(&pdev->dev, clk_name);
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 03/23] media: atomisp: ia_ccs_debug.c: increase enable_info buffer
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 01/23] media: allegro-dvt: increase buffer size in msg_type_name() Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 02/23] media: cadence: increase buffer size in csi2tx_get_resources() Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 04/23] media: vivid: avoid integer overflow Hans Verkuil
` (19 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Hans de Goede, Arnd Bergmann
Fixes these compiler warnings:
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c: In function 'ia_css_debug_pipe_graph_dump_stage':
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2786:66: warning: '\n' directive output may be truncated writing 2 bytes into a region of size between 0 and 198 [-Wformat-truncation=]
2786 | "%s\\n%s\\n%s",
| ^~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2785:49: note: 'snprintf' output between 5 and 302 bytes into a destination of size 200
2785 | snprintf(enable_info, sizeof(enable_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2786 | "%s\\n%s\\n%s",
| ~~~~~~~~~~~~~~~
2787 | enable_info1, enable_info2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2788 | enable_info3);
| ~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2772:66: warning: '\n' directive output may be truncated writing 2 bytes into a region of size between 0 and 198 [-Wformat-truncation=]
2772 | "%s\\n%s\\n%s",
| ^~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2771:49: note: 'snprintf' output between 5 and 302 bytes into a destination of size 200
2771 | snprintf(enable_info, sizeof(enable_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2772 | "%s\\n%s\\n%s",
| ~~~~~~~~~~~~~~~
2773 | enable_info1, enable_info2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2774 | enable_info3);
| ~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2749:92: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
2749 | snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
| ^
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2749:41: note: 'snprintf' output between 3 and 201 bytes into a destination of size 200
2749 | snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2750 | enable_info1, enable_info2);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
.../staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
index bb6204cb42c5..8b0251073f93 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
@@ -2673,7 +2673,7 @@ ia_css_debug_pipe_graph_dump_stage(
char enable_info1[100];
char enable_info2[100];
char enable_info3[100];
- char enable_info[200];
+ char enable_info[302];
struct ia_css_binary_info *bi = stage->binary_info;
/* Split it in 2 function-calls to keep the amount of
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 04/23] media: vivid: avoid integer overflow
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (2 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 03/23] media: atomisp: ia_ccs_debug.c: increase enable_info buffer Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 05/23] media: ipu-bridge: increase sensor_name size Hans Verkuil
` (18 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Arnd Bergmann
Fixes these compiler warnings:
drivers/media/test-drivers/vivid/vivid-rds-gen.c: In function 'vivid_rds_gen_fill':
drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:56: warning: '.' directive output may be truncated writing 1 byte into a region of size between 0 and 3 [-Wformat-truncation=]
147 | snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
| ^
drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:52: note: directive argument in the range [0, 9]
147 | snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
| ^~~~~~~~~
drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:9: note: 'snprintf' output between 9 and 12 bytes into a destination of size 9
147 | snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148 | freq / 16, ((freq & 0xf) * 10) / 16);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/test-drivers/vivid/vivid-rds-gen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/test-drivers/vivid/vivid-rds-gen.c b/drivers/media/test-drivers/vivid/vivid-rds-gen.c
index b5b104ee64c9..c57771119a34 100644
--- a/drivers/media/test-drivers/vivid/vivid-rds-gen.c
+++ b/drivers/media/test-drivers/vivid/vivid-rds-gen.c
@@ -145,7 +145,7 @@ void vivid_rds_gen_fill(struct vivid_rds_gen *rds, unsigned freq,
rds->ta = alt;
rds->ms = true;
snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
- freq / 16, ((freq & 0xf) * 10) / 16);
+ (freq / 16) % 1000000, (((freq & 0xf) * 10) / 16) % 10);
if (alt)
strscpy(rds->radiotext,
" The Radio Data System can switch between different Radio Texts ",
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 05/23] media: ipu-bridge: increase sensor_name size
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (3 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 04/23] media: vivid: avoid integer overflow Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 06/23] media: cx18: increase in_workq_name size Hans Verkuil
` (17 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Arnd Bergmann
Fixes this compiler warning:
In file included from include/linux/property.h:14,
from include/linux/acpi.h:16,
from drivers/media/pci/intel/ipu-bridge.c:4:
In function 'ipu_bridge_init_swnode_names',
inlined from 'ipu_bridge_create_connection_swnodes' at drivers/media/pci/intel/ipu-bridge.c:445:2,
inlined from 'ipu_bridge_connect_sensor' at drivers/media/pci/intel/ipu-bridge.c:656:3:
include/linux/fwnode.h:81:49: warning: '%u' directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Wformat-truncation=]
81 | #define SWNODE_GRAPH_PORT_NAME_FMT "port@%u"
| ^~~~~~~~~
drivers/media/pci/intel/ipu-bridge.c:384:18: note: in expansion of macro 'SWNODE_GRAPH_PORT_NAME_FMT'
384 | SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fwnode.h: In function 'ipu_bridge_connect_sensor':
include/linux/fwnode.h:81:55: note: format string is defined here
81 | #define SWNODE_GRAPH_PORT_NAME_FMT "port@%u"
| ^~
In function 'ipu_bridge_init_swnode_names',
inlined from 'ipu_bridge_create_connection_swnodes' at drivers/media/pci/intel/ipu-bridge.c:445:2,
inlined from 'ipu_bridge_connect_sensor' at drivers/media/pci/intel/ipu-bridge.c:656:3:
include/linux/fwnode.h:81:49: note: directive argument in the range [0, 255]
81 | #define SWNODE_GRAPH_PORT_NAME_FMT "port@%u"
| ^~~~~~~~~
drivers/media/pci/intel/ipu-bridge.c:384:18: note: in expansion of macro 'SWNODE_GRAPH_PORT_NAME_FMT'
384 | SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/pci/intel/ipu-bridge.c:382:9: note: 'snprintf' output between 7 and 9 bytes into a destination of size 7
382 | snprintf(sensor->node_names.remote_port,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
383 | sizeof(sensor->node_names.remote_port),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 | SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
include/media/ipu-bridge.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/media/ipu-bridge.h b/include/media/ipu-bridge.h
index bdc654a45521..783bda6d5cc3 100644
--- a/include/media/ipu-bridge.h
+++ b/include/media/ipu-bridge.h
@@ -108,7 +108,7 @@ struct ipu_node_names {
char ivsc_sensor_port[7];
char ivsc_ipu_port[7];
char endpoint[11];
- char remote_port[7];
+ char remote_port[9];
char vcm[16];
};
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 06/23] media: cx18: increase in_workq_name size
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (4 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 05/23] media: ipu-bridge: increase sensor_name size Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 07/23] media: rc: ati_remote: increase mouse_name buffer size Hans Verkuil
` (16 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Arnd Bergmann
Fixes this compiler warning:
drivers/media/pci/cx18/cx18-driver.c: In function 'cx18_init_struct1':
drivers/media/pci/cx18/cx18-driver.c:688:65: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 11 [-Wformat-truncation=]
688 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
| ^~
In function 'cx18_create_in_workq',
inlined from 'cx18_init_struct1' at drivers/media/pci/cx18/cx18-driver.c:724:8:
drivers/media/pci/cx18/cx18-driver.c:688:9: note: 'snprintf' output between 4 and 39 bytes into a destination of size 11
688 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
689 | cx->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/pci/cx18/cx18-driver.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/cx18/cx18-driver.h b/drivers/media/pci/cx18/cx18-driver.h
index 887d2aa36447..af05bde75816 100644
--- a/drivers/media/pci/cx18/cx18-driver.h
+++ b/drivers/media/pci/cx18/cx18-driver.h
@@ -631,7 +631,7 @@ struct cx18 {
u32 hw2_irq_mask;
struct workqueue_struct *in_work_queue;
- char in_workq_name[11]; /* "cx18-NN-in" */
+ char in_workq_name[39]; /* "cx18-NN-in" */
struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 07/23] media: rc: ati_remote: increase mouse_name buffer size
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (5 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 06/23] media: cx18: increase in_workq_name size Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 08/23] media: cec.h: increase input_phys buffer Hans Verkuil
` (15 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Sean Young, Arnd Bergmann
Fixes this compiler warning:
drivers/media/rc/ati_remote.c: In function 'ati_remote_probe':
drivers/media/rc/ati_remote.c:876:21: warning: ' mouse' directive output may be truncated writing 6 bytes into a region of size between 1 and 80 [-Wformat-truncation=]
876 | "%s mouse", ati_remote->rc_name);
| ^~~~~~
drivers/media/rc/ati_remote.c:875:9: note: 'snprintf' output between 7 and 86 bytes into a destination of size 80
875 | snprintf(ati_remote->mouse_name, sizeof(ati_remote->mouse_name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
876 | "%s mouse", ati_remote->rc_name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sean Young <sean@mess.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/rc/ati_remote.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index fff4dd48eaca..d7721e60776e 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -251,7 +251,7 @@ struct ati_remote {
char rc_name[NAME_BUFSIZE];
char rc_phys[NAME_BUFSIZE];
- char mouse_name[NAME_BUFSIZE];
+ char mouse_name[NAME_BUFSIZE + 6];
char mouse_phys[NAME_BUFSIZE];
wait_queue_head_t wait;
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 08/23] media: cec.h: increase input_phys buffer
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (6 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 07/23] media: rc: ati_remote: increase mouse_name buffer size Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 09/23] media: renesas-ceu: keep input name simple Hans Verkuil
` (14 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
Fixes this compiler warning:
drivers/media/cec/core/cec-core.c: In function 'cec_allocate_adapter':
drivers/media/cec/core/cec-core.c:317:21: warning: '/input0' directive output may be truncated writing 7 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
317 | "%s/input0", adap->name);
| ^~~~~~~
drivers/media/cec/core/cec-core.c:316:9: note: 'snprintf' output between 8 and 39 bytes into a destination of size 32
316 | snprintf(adap->input_phys, sizeof(adap->input_phys),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317 | "%s/input0", adap->name);
| ~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
include/media/cec.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/media/cec.h b/include/media/cec.h
index 9c007f83569a..53e4b2eb2b26 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -275,7 +275,7 @@ struct cec_adapter {
u32 sequence;
- char input_phys[32];
+ char input_phys[40];
};
static inline void *cec_get_drvdata(const struct cec_adapter *adap)
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 09/23] media: renesas-ceu: keep input name simple
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (7 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 08/23] media: cec.h: increase input_phys buffer Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 10/23] media: zoran: increase name size Hans Verkuil
` (13 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Jacopo Mondi
Just show the Camera index as input name in VIDIOC_ENUM_INPUT,
no need to show the subdev name as well as that is meaningless for
users anyway.
This fixes this compiler warning:
drivers/media/platform/renesas/renesas-ceu.c: In function 'ceu_enum_input':
drivers/media/platform/renesas/renesas-ceu.c:1195:59: warning: '%s' directive output may be truncated writing up to 47 bytes into a region of size between 14 and 23 [-Wformat-truncation=]
1195 | snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
| ^~
drivers/media/platform/renesas/renesas-ceu.c:1195:9: note: 'snprintf' output between 10 and 66 bytes into a destination of size 32
1195 | snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1196 | inp->index, ceusd->v4l2_sd->name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
drivers/media/platform/renesas/renesas-ceu.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/media/platform/renesas/renesas-ceu.c b/drivers/media/platform/renesas/renesas-ceu.c
index ec631c6e2a57..2562b30acfb9 100644
--- a/drivers/media/platform/renesas/renesas-ceu.c
+++ b/drivers/media/platform/renesas/renesas-ceu.c
@@ -1183,17 +1183,13 @@ static int ceu_enum_input(struct file *file, void *priv,
struct v4l2_input *inp)
{
struct ceu_device *ceudev = video_drvdata(file);
- struct ceu_subdev *ceusd;
if (inp->index >= ceudev->num_sd)
return -EINVAL;
- ceusd = ceudev->subdevs[inp->index];
-
inp->type = V4L2_INPUT_TYPE_CAMERA;
inp->std = 0;
- snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
- inp->index, ceusd->v4l2_sd->name);
+ snprintf(inp->name, sizeof(inp->name), "Camera %u", inp->index);
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 10/23] media: zoran: increase name size
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (8 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 09/23] media: renesas-ceu: keep input name simple Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device " Hans Verkuil
` (12 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Corentin Labbe
Fixes this compiler warning:
drivers/media/pci/zoran/zoran_card.c: In function 'zoran_probe':
drivers/media/pci/zoran/zoran_card.c:1316:62: warning: '%u' directive output may be truncated writing between 1 and 5 bytes into a region of size between 0 and 31 [-Wformat-truncation=]
1316 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]",
| ^~
drivers/media/pci/zoran/zoran_card.c:1316:58: note: directive argument in the range [0, 65535]
1316 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]",
| ^~~~~~~~
drivers/media/pci/zoran/zoran_card.c:1316:9: note: 'snprintf' output between 4 and 39 bytes into a destination of size 32
1316 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1317 | zr->card.name, zr->id);
| ~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Corentin Labbe <clabbe@baylibre.com>
---
drivers/media/pci/zoran/zoran.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h
index 56340553b282..1cd990468d3d 100644
--- a/drivers/media/pci/zoran/zoran.h
+++ b/drivers/media/pci/zoran/zoran.h
@@ -219,7 +219,7 @@ struct zoran {
const struct tvnorm *timing;
unsigned short id; /* number of this device */
- char name[32]; /* name of this device */
+ char name[40]; /* name of this device */
struct pci_dev *pci_dev; /* PCI device */
unsigned char revision; /* revision of zr36057 */
unsigned char __iomem *zr36057_mem;/* pointer to mapped IO memory */
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device name size
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (9 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 10/23] media: zoran: increase name size Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-24 10:55 ` Sakari Ailus
2023-09-23 15:20 ` [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev " Hans Verkuil
` (11 subsequent siblings)
22 siblings, 1 reply; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
Increase the size of the name field to prevent a lot of
string truncate compiler warnings.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
include/media/v4l2-dev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index e0a13505f88d..d82dfdbf6e58 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -284,7 +284,7 @@ struct video_device {
struct v4l2_prio_state *prio;
/* device info */
- char name[32];
+ char name[64];
enum vfl_devnode_type vfl_type;
enum vfl_devnode_direction vfl_dir;
int minor;
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev name size
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (10 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device " Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 18:11 ` Laurent Pinchart
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
` (10 subsequent siblings)
22 siblings, 1 reply; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
This resolves a lot of the string truncate compiler warnings.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/staging/media/omap4iss/iss_csi2.c | 2 +-
include/media/v4l2-subdev.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
index 04ce0e7eb557..d2844414de4f 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.c
+++ b/drivers/staging/media/omap4iss/iss_csi2.c
@@ -1260,7 +1260,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
struct media_pad *pads = csi2->pads;
struct media_entity *me = &sd->entity;
int ret;
- char name[V4L2_SUBDEV_NAME_SIZE];
+ char name[32];
v4l2_subdev_init(sd, &csi2_ops);
sd->internal_ops = &csi2_internal_ops;
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5f59ff0796b7..5711354056b9 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -951,7 +951,7 @@ struct v4l2_subdev_internal_ops {
void (*release)(struct v4l2_subdev *sd);
};
-#define V4L2_SUBDEV_NAME_SIZE 32
+#define V4L2_SUBDEV_NAME_SIZE 52
/* Set this flag if this subdev is a i2c device. */
#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (11 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev " Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 18:06 ` Laurent Pinchart
` (3 more replies)
2023-09-23 15:20 ` [PATCHv2 14/23] media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE Hans Verkuil
` (9 subsequent siblings)
22 siblings, 4 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media
Cc: Arnd Bergmann, Hans Verkuil, Luca Ceresoli, Maxime Ripard,
Niklas Söderlund, Sowjanya Komatineni, Laurent Pinchart
Don't rely on a define, let the compiler use the actual
field size.
Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
drop the define itself.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Cc: Sowjanya Komatineni <skomatineni@nvidia.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/i2c/msp3400-driver.c | 2 +-
drivers/media/platform/cadence/cdns-csi2rx.c | 4 ++--
drivers/media/platform/cadence/cdns-csi2tx.c | 4 ++--
drivers/media/platform/renesas/rcar-isp.c | 2 +-
drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 2 +-
drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
drivers/staging/media/tegra-video/csi.c | 4 ++--
drivers/staging/media/tegra-video/vip.c | 2 +-
include/media/v4l2-subdev.h | 4 +---
9 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
index bec76801487a..0ed8561edfee 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -561,7 +561,7 @@ static int msp_log_status(struct v4l2_subdev *sd)
struct msp_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
const char *p;
- char prefix[V4L2_SUBDEV_NAME_SIZE + 20];
+ char prefix[sizeof(sd->name) + 20];
if (state->opmode == OPMODE_AUTOSELECT)
msp_detect_stereo(client);
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 0d879d71d818..b9d9058e2ce3 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -516,8 +516,8 @@ static int csi2rx_probe(struct platform_device *pdev)
csi2rx->subdev.dev = &pdev->dev;
v4l2_subdev_init(&csi2rx->subdev, &csi2rx_subdev_ops);
v4l2_set_subdevdata(&csi2rx->subdev, &pdev->dev);
- snprintf(csi2rx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
- KBUILD_MODNAME, dev_name(&pdev->dev));
+ snprintf(csi2rx->subdev.name, sizeof(csi2rx->subdev.name),
+ "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));
/* Create our media pads */
csi2rx->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c
index cbbb77520112..c115742f347f 100644
--- a/drivers/media/platform/cadence/cdns-csi2tx.c
+++ b/drivers/media/platform/cadence/cdns-csi2tx.c
@@ -592,8 +592,8 @@ static int csi2tx_probe(struct platform_device *pdev)
csi2tx->subdev.owner = THIS_MODULE;
csi2tx->subdev.dev = &pdev->dev;
csi2tx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
- snprintf(csi2tx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
- KBUILD_MODNAME, dev_name(&pdev->dev));
+ snprintf(csi2tx->subdev.name, sizeof(csi2tx->subdev.name),
+ "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));
ret = csi2tx_check_lanes(csi2tx);
if (ret)
diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
index 7360cf3863f2..19a005d83733 100644
--- a/drivers/media/platform/renesas/rcar-isp.c
+++ b/drivers/media/platform/renesas/rcar-isp.c
@@ -467,7 +467,7 @@ static int risp_probe(struct platform_device *pdev)
isp->subdev.dev = &pdev->dev;
v4l2_subdev_init(&isp->subdev, &rcar_isp_subdev_ops);
v4l2_set_subdevdata(&isp->subdev, &pdev->dev);
- snprintf(isp->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
+ snprintf(isp->subdev.name, sizeof(isp->subdev.name), "%s %s",
KBUILD_MODNAME, dev_name(&pdev->dev));
isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
index f6326df0b09b..66fe553a00e7 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
@@ -1889,7 +1889,7 @@ static int rcsi2_probe(struct platform_device *pdev)
priv->subdev.dev = &pdev->dev;
v4l2_subdev_init(&priv->subdev, &rcar_csi2_subdev_ops);
v4l2_set_subdevdata(&priv->subdev, &pdev->dev);
- snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
+ snprintf(priv->subdev.name, sizeof(priv->subdev.name), "%s %s",
KBUILD_MODNAME, dev_name(&pdev->dev));
priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c b/drivers/media/platform/ti/omap3isp/ispstat.c
index 68cf68dbcace..359a846205b0 100644
--- a/drivers/media/platform/ti/omap3isp/ispstat.c
+++ b/drivers/media/platform/ti/omap3isp/ispstat.c
@@ -1039,7 +1039,7 @@ static int isp_stat_init_entities(struct ispstat *stat, const char *name,
struct media_entity *me = &subdev->entity;
v4l2_subdev_init(subdev, sd_ops);
- snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "OMAP3 ISP %s", name);
+ snprintf(subdev->name, sizeof(subdev->name), "OMAP3 ISP %s", name);
subdev->grp_id = BIT(16); /* group ID for isp subdevs */
subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
v4l2_set_subdevdata(subdev, stat);
diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
index e79657920dc8..9aa72863c213 100644
--- a/drivers/staging/media/tegra-video/csi.c
+++ b/drivers/staging/media/tegra-video/csi.c
@@ -607,10 +607,10 @@ static int tegra_csi_channel_init(struct tegra_csi_channel *chan)
v4l2_subdev_init(subdev, &tegra_csi_ops);
subdev->dev = csi->dev;
if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
- snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s-%d", "tpg",
+ snprintf(subdev->name, sizeof(subdev->name), "%s-%d", "tpg",
chan->csi_port_nums[0]);
else
- snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
+ snprintf(subdev->name, sizeof(subdev->name), "%s",
kbasename(chan->of_node->full_name));
v4l2_set_subdevdata(subdev, chan);
diff --git a/drivers/staging/media/tegra-video/vip.c b/drivers/staging/media/tegra-video/vip.c
index 191ecd19a6a7..e95cc7bb190e 100644
--- a/drivers/staging/media/tegra-video/vip.c
+++ b/drivers/staging/media/tegra-video/vip.c
@@ -163,7 +163,7 @@ static int tegra_vip_channel_init(struct tegra_vip *vip)
subdev = &vip->chan.subdev;
v4l2_subdev_init(subdev, &tegra_vip_ops);
subdev->dev = vip->dev;
- snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
+ snprintf(subdev->name, sizeof(subdev->name), "%s",
kbasename(vip->chan.of_node->full_name));
v4l2_set_subdevdata(subdev, &vip->chan);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5711354056b9..c1f90c1223a7 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -951,8 +951,6 @@ struct v4l2_subdev_internal_ops {
void (*release)(struct v4l2_subdev *sd);
};
-#define V4L2_SUBDEV_NAME_SIZE 52
-
/* Set this flag if this subdev is a i2c device. */
#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
/* Set this flag if this subdev is a spi device. */
@@ -1062,7 +1060,7 @@ struct v4l2_subdev {
const struct v4l2_subdev_ops *ops;
const struct v4l2_subdev_internal_ops *internal_ops;
struct v4l2_ctrl_handler *ctrl_handler;
- char name[V4L2_SUBDEV_NAME_SIZE];
+ char name[52];
u32 grp_id;
void *dev_priv;
void *host_priv;
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 14/23] media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (12 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 15/23] media: vivid: use VIVID_MODULE_NAME to fill bus_info Hans Verkuil
` (8 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
Don't use defines for the size of a name field, everyone
should just use sizeof(). In this case it was never used,
but it is bad practice, so just drop it.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
include/media/v4l2-device.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 8a8977a33ec1..f6f111fae33c 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -13,8 +13,6 @@
#include <media/v4l2-subdev.h>
#include <media/v4l2-dev.h>
-#define V4L2_DEVICE_NAME_SIZE (20 + 16)
-
struct v4l2_ctrl_handler;
/**
@@ -49,7 +47,7 @@ struct v4l2_device {
struct media_device *mdev;
struct list_head subdevs;
spinlock_t lock;
- char name[V4L2_DEVICE_NAME_SIZE];
+ char name[36];
void (*notify)(struct v4l2_subdev *sd,
unsigned int notification, void *arg);
struct v4l2_ctrl_handler *ctrl_handler;
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 15/23] media: vivid: use VIVID_MODULE_NAME to fill bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (13 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 14/23] media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE Hans Verkuil
@ 2023-09-23 15:20 ` Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 16/23] media: microchip: don't set bus_info Hans Verkuil
` (7 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:20 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
Fixes this compiler warning:
drivers/media/test-drivers/vivid/vivid-core.c: In function 'vidioc_querycap':
drivers/media/test-drivers/vivid/vivid-core.c:243:35: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
243 | "platform:%s", dev->v4l2_dev.name);
| ^~
drivers/media/test-drivers/vivid/vivid-core.c:242:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
242 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243 | "platform:%s", dev->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/media/test-drivers/vivid/vivid-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index e95bdccfc18e..394c9f81ea72 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -240,7 +240,7 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->driver, "vivid", sizeof(cap->driver));
strscpy(cap->card, "vivid", sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info),
- "platform:%s", dev->v4l2_dev.name);
+ "platform:%s-%03d", VIVID_MODULE_NAME, dev->inst);
cap->capabilities = dev->vid_cap_caps | dev->vid_out_caps |
dev->vbi_cap_caps | dev->vbi_out_caps |
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 16/23] media: microchip: don't set bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (14 preceding siblings ...)
2023-09-23 15:20 ` [PATCHv2 15/23] media: vivid: use VIVID_MODULE_NAME to fill bus_info Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-25 12:01 ` Nicolas Ferre
2023-09-23 15:21 ` [PATCHv2 17/23] media: rcar_drif: use explicit name for bus_info Hans Verkuil
` (6 subsequent siblings)
22 siblings, 1 reply; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Eugen Hristev, Nicolas Ferre
Let the V4L2 core fill this in.
Fixes these compiler warnings:
drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_querycap':
drivers/media/platform/microchip/microchip-isc-base.c:486:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
486 | "platform:%s", isc->v4l2_dev.name);
| ^~
drivers/media/platform/microchip/microchip-isc-base.c:485:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
485 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486 | "platform:%s", isc->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_mc_init':
drivers/media/platform/microchip/microchip-isc-base.c:1996:76: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
1996 | snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
| ^~
drivers/media/platform/microchip/microchip-isc-base.c:1996:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
1996 | snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1997 | isc->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Eugen Hristev <eugen.hristev@collabora.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
---
drivers/media/platform/microchip/microchip-isc-base.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 8dbf7bc1e863..1f8528844497 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -478,12 +478,8 @@ static const struct vb2_ops isc_vb2_ops = {
static int isc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
- struct isc_device *isc = video_drvdata(file);
-
strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
strscpy(cap->card, "Microchip Image Sensor Controller", sizeof(cap->card));
- snprintf(cap->bus_info, sizeof(cap->bus_info),
- "platform:%s", isc->v4l2_dev.name);
return 0;
}
@@ -1993,8 +1989,6 @@ int isc_mc_init(struct isc_device *isc, u32 ver)
strscpy(isc->mdev.driver_name, KBUILD_MODNAME,
sizeof(isc->mdev.driver_name));
strscpy(isc->mdev.model, match->compatible, sizeof(isc->mdev.model));
- snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
- isc->v4l2_dev.name);
isc->mdev.hw_revision = ver;
media_device_init(&isc->mdev);
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 17/23] media: rcar_drif: use explicit name for bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (15 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 16/23] media: microchip: don't set bus_info Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 18/23] media: am437x: don't fill in bus_info Hans Verkuil
` (5 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Fabrizio Castro
Fixes this compiler warning:
drivers/media/platform/renesas/rcar_drif.c: In function 'rcar_drif_querycap':
drivers/media/platform/renesas/rcar_drif.c:874:66: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 23 [-Wformat-truncation=]
874 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
| ^~
drivers/media/platform/renesas/rcar_drif.c:874:9: note: 'snprintf' output between 10 and 73 bytes into a destination of size 32
874 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
875 | sdr->vdev->name);
| ~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
drivers/media/platform/renesas/rcar_drif.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/media/platform/renesas/rcar_drif.c b/drivers/media/platform/renesas/rcar_drif.c
index 163a4ba61c17..292c5bf9e50c 100644
--- a/drivers/media/platform/renesas/rcar_drif.c
+++ b/drivers/media/platform/renesas/rcar_drif.c
@@ -871,8 +871,7 @@ static int rcar_drif_querycap(struct file *file, void *fh,
strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver));
strscpy(cap->card, sdr->vdev->name, sizeof(cap->card));
- snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
- sdr->vdev->name);
+ strscpy(cap->bus_info, "platform:R-Car DRIF", sizeof(cap->bus_info));
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 18/23] media: am437x: don't fill in bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (16 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 17/23] media: rcar_drif: use explicit name for bus_info Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-25 7:45 ` Lad, Prabhakar
2023-09-23 15:21 ` [PATCHv2 19/23] media: atmel: drop bus_info Hans Verkuil
` (4 subsequent siblings)
22 siblings, 1 reply; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Lad, Prabhakar
Let the V4L2 core fill this in.
This fixes this warning:
drivers/media/platform/ti/am437x/am437x-vpfe.c: In function 'vpfe_querycap':
drivers/media/platform/ti/am437x/am437x-vpfe.c:1279:35: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
1279 | "platform:%s", vpfe->v4l2_dev.name);
| ^~
drivers/media/platform/ti/am437x/am437x-vpfe.c:1278:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
1278 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1279 | "platform:%s", vpfe->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
---
drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
index 63092013d476..5fa2ea9025d9 100644
--- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
@@ -1271,12 +1271,8 @@ static inline void vpfe_attach_irq(struct vpfe_device *vpfe)
static int vpfe_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
- struct vpfe_device *vpfe = video_drvdata(file);
-
strscpy(cap->driver, VPFE_MODULE_NAME, sizeof(cap->driver));
strscpy(cap->card, "TI AM437x VPFE", sizeof(cap->card));
- snprintf(cap->bus_info, sizeof(cap->bus_info),
- "platform:%s", vpfe->v4l2_dev.name);
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 19/23] media: atmel: drop bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (17 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 18/23] media: am437x: don't fill in bus_info Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-25 12:01 ` Nicolas Ferre
2023-09-23 15:21 ` [PATCHv2 20/23] media: radio-isa: use dev_name to fill in bus_info Hans Verkuil
` (3 subsequent siblings)
22 siblings, 1 reply; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Eugen Hristev, Nicolas Ferre
Let the V4L2 core fill this in.
Fixes this warning:
drivers/staging/media/deprecated/atmel/atmel-isc-base.c: In function 'isc_querycap':
drivers/staging/media/deprecated/atmel/atmel-isc-base.c:496:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
496 | "platform:%s", isc->v4l2_dev.name);
| ^~
drivers/staging/media/deprecated/atmel/atmel-isc-base.c:495:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
495 | snprintf(cap->bus_info, sizeof(cap->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
496 | "platform:%s", isc->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Eugen Hristev <eugen.hristev@collabora.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
---
drivers/staging/media/deprecated/atmel/atmel-isc-base.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/staging/media/deprecated/atmel/atmel-isc-base.c b/drivers/staging/media/deprecated/atmel/atmel-isc-base.c
index f5d963904201..8e26663cecb6 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-isc-base.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-isc-base.c
@@ -488,12 +488,8 @@ static const struct vb2_ops isc_vb2_ops = {
static int isc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
- struct isc_device *isc = video_drvdata(file);
-
strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
strscpy(cap->card, "Atmel Image Sensor Controller", sizeof(cap->card));
- snprintf(cap->bus_info, sizeof(cap->bus_info),
- "platform:%s", isc->v4l2_dev.name);
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 20/23] media: radio-isa: use dev_name to fill in bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (18 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 19/23] media: atmel: drop bus_info Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 21/23] media: radio-miropcm20: set bus_info to explicit name Hans Verkuil
` (2 subsequent siblings)
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
This fixes this warning:
drivers/media/radio/radio-isa.c: In function 'radio_isa_querycap':
drivers/media/radio/radio-isa.c:39:57: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 28 [-Wformat-truncation=]
39 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
| ^~
drivers/media/radio/radio-isa.c:39:9: note: 'snprintf' output between 5 and 40 bytes into a destination of size 32
39 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/media/radio/radio-isa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/radio/radio-isa.c b/drivers/media/radio/radio-isa.c
index c591c0851fa2..ad49151f5ff0 100644
--- a/drivers/media/radio/radio-isa.c
+++ b/drivers/media/radio/radio-isa.c
@@ -36,7 +36,7 @@ static int radio_isa_querycap(struct file *file, void *priv,
strscpy(v->driver, isa->drv->driver.driver.name, sizeof(v->driver));
strscpy(v->card, isa->drv->card, sizeof(v->card));
- snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
+ snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev_name(isa->v4l2_dev.dev));
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 21/23] media: radio-miropcm20: set bus_info to explicit name
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (19 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 20/23] media: radio-isa: use dev_name to fill in bus_info Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 22/23] media: verisilicon: replace snprintf with strscpy+strlcat Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 23/23] media: radio-si476x: don't fill in bus_info Hans Verkuil
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
Fill in bus_info with fixed name.
This fixes this compiler warning:
drivers/media/radio/radio-miropcm20.c: In function 'vidioc_querycap':
drivers/media/radio/radio-miropcm20.c:206:57: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 28 [-Wformat-truncation=]
206 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev->v4l2_dev.name);
| ^~
drivers/media/radio/radio-miropcm20.c:206:9: note: 'snprintf' output between 5 and 40 bytes into a destination of size 32
206 | snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev->v4l2_dev.name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/media/radio/radio-miropcm20.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c
index 99788834c646..08be77b8f3b7 100644
--- a/drivers/media/radio/radio-miropcm20.c
+++ b/drivers/media/radio/radio-miropcm20.c
@@ -199,11 +199,9 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *v)
{
- struct pcm20 *dev = video_drvdata(file);
-
strscpy(v->driver, "Miro PCM20", sizeof(v->driver));
strscpy(v->card, "Miro PCM20", sizeof(v->card));
- snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev->v4l2_dev.name);
+ strscpy(v->bus_info, "ISA:radio-miropcm20", sizeof(v->bus_info));
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 22/23] media: verisilicon: replace snprintf with strscpy+strlcat
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (20 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 21/23] media: radio-miropcm20: set bus_info to explicit name Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 23/23] media: radio-si476x: don't fill in bus_info Hans Verkuil
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil, Ezequiel Garcia, Philipp Zabel
Fixes this warning:
drivers/media/platform/verisilicon/hantro_drv.c: In function 'hantro_add_func':
drivers/media/platform/verisilicon/hantro_drv.c:902:49: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 64 [-Wformat-truncation=]
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~
drivers/media/platform/verisilicon/hantro_drv.c:902:9: note: 'snprintf' output between 5 and 132 bytes into a destination of size 64
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
903 | funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "enc" : "dec");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/hantro_drv.c:902:49: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 64 [-Wformat-truncation=]
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~
drivers/media/platform/verisilicon/hantro_drv.c:902:9: note: 'snprintf' output between 5 and 132 bytes into a destination of size 64
902 | snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
903 | funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "enc" : "dec");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/media/platform/verisilicon/hantro_drv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 50ec24c753e9..a9fa05ac56a9 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -899,8 +899,9 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)
vfd->vfl_dir = VFL_DIR_M2M;
vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
vfd->ioctl_ops = &hantro_ioctl_ops;
- snprintf(vfd->name, sizeof(vfd->name), "%s-%s", match->compatible,
- funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "enc" : "dec");
+ strscpy(vfd->name, match->compatible, sizeof(vfd->name));
+ strlcat(vfd->name, funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ?
+ "-enc" : "-dec", sizeof(vfd->name));
if (funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER) {
vpu->encoder = func;
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHv2 23/23] media: radio-si476x: don't fill in bus_info
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
` (21 preceding siblings ...)
2023-09-23 15:21 ` [PATCHv2 22/23] media: verisilicon: replace snprintf with strscpy+strlcat Hans Verkuil
@ 2023-09-23 15:21 ` Hans Verkuil
22 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-23 15:21 UTC (permalink / raw)
To: linux-media; +Cc: Arnd Bergmann, Hans Verkuil
Let the V4L2 core fill in bus_info.
This fixes this warning:
drivers/media/radio/radio-si476x.c: In function 'si476x_radio_querycap':
drivers/media/radio/radio-si476x.c:333:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
333 | "platform:%s", radio->v4l2dev.name);
| ^~
drivers/media/radio/radio-si476x.c:332:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
332 | snprintf(capability->bus_info, sizeof(capability->bus_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333 | "platform:%s", radio->v4l2dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/media/radio/radio-si476x.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
index 6061506159f1..b2c5809a8bc7 100644
--- a/drivers/media/radio/radio-si476x.c
+++ b/drivers/media/radio/radio-si476x.c
@@ -328,9 +328,7 @@ static int si476x_radio_querycap(struct file *file, void *priv,
strscpy(capability->driver, radio->v4l2dev.name,
sizeof(capability->driver));
- strscpy(capability->card, DRIVER_CARD, sizeof(capability->card));
- snprintf(capability->bus_info, sizeof(capability->bus_info),
- "platform:%s", radio->v4l2dev.name);
+ strscpy(capability->card, DRIVER_CARD, sizeof(capability->card));
return 0;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
@ 2023-09-23 18:06 ` Laurent Pinchart
2023-09-23 19:33 ` Niklas Söderlund
` (2 subsequent siblings)
3 siblings, 0 replies; 37+ messages in thread
From: Laurent Pinchart @ 2023-09-23 18:06 UTC (permalink / raw)
To: Hans Verkuil
Cc: linux-media, Arnd Bergmann, Luca Ceresoli, Maxime Ripard,
Niklas Söderlund, Sowjanya Komatineni
Hi Hans,
Thank you for the patch.
On Sat, Sep 23, 2023 at 05:20:57PM +0200, Hans Verkuil wrote:
> Don't rely on a define, let the compiler use the actual
> field size.
>
> Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
> drop the define itself.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Cc: Sowjanya Komatineni <skomatineni@nvidia.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/media/i2c/msp3400-driver.c | 2 +-
> drivers/media/platform/cadence/cdns-csi2rx.c | 4 ++--
> drivers/media/platform/cadence/cdns-csi2tx.c | 4 ++--
> drivers/media/platform/renesas/rcar-isp.c | 2 +-
> drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 2 +-
> drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
> drivers/staging/media/tegra-video/csi.c | 4 ++--
> drivers/staging/media/tegra-video/vip.c | 2 +-
> include/media/v4l2-subdev.h | 4 +---
> 9 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
> index bec76801487a..0ed8561edfee 100644
> --- a/drivers/media/i2c/msp3400-driver.c
> +++ b/drivers/media/i2c/msp3400-driver.c
> @@ -561,7 +561,7 @@ static int msp_log_status(struct v4l2_subdev *sd)
> struct msp_state *state = to_state(sd);
> struct i2c_client *client = v4l2_get_subdevdata(sd);
> const char *p;
> - char prefix[V4L2_SUBDEV_NAME_SIZE + 20];
> + char prefix[sizeof(sd->name) + 20];
>
> if (state->opmode == OPMODE_AUTOSELECT)
> msp_detect_stereo(client);
> diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
> index 0d879d71d818..b9d9058e2ce3 100644
> --- a/drivers/media/platform/cadence/cdns-csi2rx.c
> +++ b/drivers/media/platform/cadence/cdns-csi2rx.c
> @@ -516,8 +516,8 @@ static int csi2rx_probe(struct platform_device *pdev)
> csi2rx->subdev.dev = &pdev->dev;
> v4l2_subdev_init(&csi2rx->subdev, &csi2rx_subdev_ops);
> v4l2_set_subdevdata(&csi2rx->subdev, &pdev->dev);
> - snprintf(csi2rx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
> - KBUILD_MODNAME, dev_name(&pdev->dev));
> + snprintf(csi2rx->subdev.name, sizeof(csi2rx->subdev.name),
> + "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));
>
> /* Create our media pads */
> csi2rx->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
> diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c
> index cbbb77520112..c115742f347f 100644
> --- a/drivers/media/platform/cadence/cdns-csi2tx.c
> +++ b/drivers/media/platform/cadence/cdns-csi2tx.c
> @@ -592,8 +592,8 @@ static int csi2tx_probe(struct platform_device *pdev)
> csi2tx->subdev.owner = THIS_MODULE;
> csi2tx->subdev.dev = &pdev->dev;
> csi2tx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> - snprintf(csi2tx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
> - KBUILD_MODNAME, dev_name(&pdev->dev));
> + snprintf(csi2tx->subdev.name, sizeof(csi2tx->subdev.name),
> + "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));
>
> ret = csi2tx_check_lanes(csi2tx);
> if (ret)
> diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
> index 7360cf3863f2..19a005d83733 100644
> --- a/drivers/media/platform/renesas/rcar-isp.c
> +++ b/drivers/media/platform/renesas/rcar-isp.c
> @@ -467,7 +467,7 @@ static int risp_probe(struct platform_device *pdev)
> isp->subdev.dev = &pdev->dev;
> v4l2_subdev_init(&isp->subdev, &rcar_isp_subdev_ops);
> v4l2_set_subdevdata(&isp->subdev, &pdev->dev);
> - snprintf(isp->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
> + snprintf(isp->subdev.name, sizeof(isp->subdev.name), "%s %s",
> KBUILD_MODNAME, dev_name(&pdev->dev));
> isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
>
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
> index f6326df0b09b..66fe553a00e7 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
> @@ -1889,7 +1889,7 @@ static int rcsi2_probe(struct platform_device *pdev)
> priv->subdev.dev = &pdev->dev;
> v4l2_subdev_init(&priv->subdev, &rcar_csi2_subdev_ops);
> v4l2_set_subdevdata(&priv->subdev, &pdev->dev);
> - snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
> + snprintf(priv->subdev.name, sizeof(priv->subdev.name), "%s %s",
> KBUILD_MODNAME, dev_name(&pdev->dev));
> priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
>
> diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c b/drivers/media/platform/ti/omap3isp/ispstat.c
> index 68cf68dbcace..359a846205b0 100644
> --- a/drivers/media/platform/ti/omap3isp/ispstat.c
> +++ b/drivers/media/platform/ti/omap3isp/ispstat.c
> @@ -1039,7 +1039,7 @@ static int isp_stat_init_entities(struct ispstat *stat, const char *name,
> struct media_entity *me = &subdev->entity;
>
> v4l2_subdev_init(subdev, sd_ops);
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "OMAP3 ISP %s", name);
> + snprintf(subdev->name, sizeof(subdev->name), "OMAP3 ISP %s", name);
> subdev->grp_id = BIT(16); /* group ID for isp subdevs */
> subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
> v4l2_set_subdevdata(subdev, stat);
> diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
> index e79657920dc8..9aa72863c213 100644
> --- a/drivers/staging/media/tegra-video/csi.c
> +++ b/drivers/staging/media/tegra-video/csi.c
> @@ -607,10 +607,10 @@ static int tegra_csi_channel_init(struct tegra_csi_channel *chan)
> v4l2_subdev_init(subdev, &tegra_csi_ops);
> subdev->dev = csi->dev;
> if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s-%d", "tpg",
> + snprintf(subdev->name, sizeof(subdev->name), "%s-%d", "tpg",
> chan->csi_port_nums[0]);
> else
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
> + snprintf(subdev->name, sizeof(subdev->name), "%s",
> kbasename(chan->of_node->full_name));
>
> v4l2_set_subdevdata(subdev, chan);
> diff --git a/drivers/staging/media/tegra-video/vip.c b/drivers/staging/media/tegra-video/vip.c
> index 191ecd19a6a7..e95cc7bb190e 100644
> --- a/drivers/staging/media/tegra-video/vip.c
> +++ b/drivers/staging/media/tegra-video/vip.c
> @@ -163,7 +163,7 @@ static int tegra_vip_channel_init(struct tegra_vip *vip)
> subdev = &vip->chan.subdev;
> v4l2_subdev_init(subdev, &tegra_vip_ops);
> subdev->dev = vip->dev;
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
> + snprintf(subdev->name, sizeof(subdev->name), "%s",
> kbasename(vip->chan.of_node->full_name));
>
> v4l2_set_subdevdata(subdev, &vip->chan);
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 5711354056b9..c1f90c1223a7 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -951,8 +951,6 @@ struct v4l2_subdev_internal_ops {
> void (*release)(struct v4l2_subdev *sd);
> };
>
> -#define V4L2_SUBDEV_NAME_SIZE 52
> -
> /* Set this flag if this subdev is a i2c device. */
> #define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
> /* Set this flag if this subdev is a spi device. */
> @@ -1062,7 +1060,7 @@ struct v4l2_subdev {
> const struct v4l2_subdev_ops *ops;
> const struct v4l2_subdev_internal_ops *internal_ops;
> struct v4l2_ctrl_handler *ctrl_handler;
> - char name[V4L2_SUBDEV_NAME_SIZE];
> + char name[52];
> u32 grp_id;
> void *dev_priv;
> void *host_priv;
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev name size
2023-09-23 15:20 ` [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev " Hans Verkuil
@ 2023-09-23 18:11 ` Laurent Pinchart
2023-09-25 6:26 ` Hans Verkuil
0 siblings, 1 reply; 37+ messages in thread
From: Laurent Pinchart @ 2023-09-23 18:11 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Arnd Bergmann
Hi Hans,
Thank you for the patch.
On Sat, Sep 23, 2023 at 05:20:56PM +0200, Hans Verkuil wrote:
> This resolves a lot of the string truncate compiler warnings.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> drivers/staging/media/omap4iss/iss_csi2.c | 2 +-
> include/media/v4l2-subdev.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
> index 04ce0e7eb557..d2844414de4f 100644
> --- a/drivers/staging/media/omap4iss/iss_csi2.c
> +++ b/drivers/staging/media/omap4iss/iss_csi2.c
> @@ -1260,7 +1260,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
> struct media_pad *pads = csi2->pads;
> struct media_entity *me = &sd->entity;
> int ret;
> - char name[V4L2_SUBDEV_NAME_SIZE];
> + char name[32];
>
> v4l2_subdev_init(sd, &csi2_ops);
> sd->internal_ops = &csi2_internal_ops;
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 5f59ff0796b7..5711354056b9 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -951,7 +951,7 @@ struct v4l2_subdev_internal_ops {
> void (*release)(struct v4l2_subdev *sd);
> };
>
> -#define V4L2_SUBDEV_NAME_SIZE 32
> +#define V4L2_SUBDEV_NAME_SIZE 52
Can we allocate it dynamically instead ?
>
> /* Set this flag if this subdev is a i2c device. */
> #define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
2023-09-23 18:06 ` Laurent Pinchart
@ 2023-09-23 19:33 ` Niklas Söderlund
2023-09-25 7:42 ` Maxime Ripard
2023-09-25 16:51 ` Luca Ceresoli
3 siblings, 0 replies; 37+ messages in thread
From: Niklas Söderlund @ 2023-09-23 19:33 UTC (permalink / raw)
To: Hans Verkuil
Cc: linux-media, Arnd Bergmann, Luca Ceresoli, Maxime Ripard,
Sowjanya Komatineni, Laurent Pinchart
Hello Hans,
Thanks for your work.
On 2023-09-23 17:20:57 +0200, Hans Verkuil wrote:
> Don't rely on a define, let the compiler use the actual
> field size.
>
> Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
> drop the define itself.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Cc: Sowjanya Komatineni <skomatineni@nvidia.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
> drivers/media/i2c/msp3400-driver.c | 2 +-
> drivers/media/platform/cadence/cdns-csi2rx.c | 4 ++--
> drivers/media/platform/cadence/cdns-csi2tx.c | 4 ++--
> drivers/media/platform/renesas/rcar-isp.c | 2 +-
> drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 2 +-
> drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
> drivers/staging/media/tegra-video/csi.c | 4 ++--
> drivers/staging/media/tegra-video/vip.c | 2 +-
> include/media/v4l2-subdev.h | 4 +---
> 9 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
> index bec76801487a..0ed8561edfee 100644
> --- a/drivers/media/i2c/msp3400-driver.c
> +++ b/drivers/media/i2c/msp3400-driver.c
> @@ -561,7 +561,7 @@ static int msp_log_status(struct v4l2_subdev *sd)
> struct msp_state *state = to_state(sd);
> struct i2c_client *client = v4l2_get_subdevdata(sd);
> const char *p;
> - char prefix[V4L2_SUBDEV_NAME_SIZE + 20];
> + char prefix[sizeof(sd->name) + 20];
>
> if (state->opmode == OPMODE_AUTOSELECT)
> msp_detect_stereo(client);
> diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
> index 0d879d71d818..b9d9058e2ce3 100644
> --- a/drivers/media/platform/cadence/cdns-csi2rx.c
> +++ b/drivers/media/platform/cadence/cdns-csi2rx.c
> @@ -516,8 +516,8 @@ static int csi2rx_probe(struct platform_device *pdev)
> csi2rx->subdev.dev = &pdev->dev;
> v4l2_subdev_init(&csi2rx->subdev, &csi2rx_subdev_ops);
> v4l2_set_subdevdata(&csi2rx->subdev, &pdev->dev);
> - snprintf(csi2rx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
> - KBUILD_MODNAME, dev_name(&pdev->dev));
> + snprintf(csi2rx->subdev.name, sizeof(csi2rx->subdev.name),
> + "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));
>
> /* Create our media pads */
> csi2rx->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
> diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c
> index cbbb77520112..c115742f347f 100644
> --- a/drivers/media/platform/cadence/cdns-csi2tx.c
> +++ b/drivers/media/platform/cadence/cdns-csi2tx.c
> @@ -592,8 +592,8 @@ static int csi2tx_probe(struct platform_device *pdev)
> csi2tx->subdev.owner = THIS_MODULE;
> csi2tx->subdev.dev = &pdev->dev;
> csi2tx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> - snprintf(csi2tx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
> - KBUILD_MODNAME, dev_name(&pdev->dev));
> + snprintf(csi2tx->subdev.name, sizeof(csi2tx->subdev.name),
> + "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));
>
> ret = csi2tx_check_lanes(csi2tx);
> if (ret)
> diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
> index 7360cf3863f2..19a005d83733 100644
> --- a/drivers/media/platform/renesas/rcar-isp.c
> +++ b/drivers/media/platform/renesas/rcar-isp.c
> @@ -467,7 +467,7 @@ static int risp_probe(struct platform_device *pdev)
> isp->subdev.dev = &pdev->dev;
> v4l2_subdev_init(&isp->subdev, &rcar_isp_subdev_ops);
> v4l2_set_subdevdata(&isp->subdev, &pdev->dev);
> - snprintf(isp->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
> + snprintf(isp->subdev.name, sizeof(isp->subdev.name), "%s %s",
> KBUILD_MODNAME, dev_name(&pdev->dev));
> isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
>
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
> index f6326df0b09b..66fe553a00e7 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c
> @@ -1889,7 +1889,7 @@ static int rcsi2_probe(struct platform_device *pdev)
> priv->subdev.dev = &pdev->dev;
> v4l2_subdev_init(&priv->subdev, &rcar_csi2_subdev_ops);
> v4l2_set_subdevdata(&priv->subdev, &pdev->dev);
> - snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
> + snprintf(priv->subdev.name, sizeof(priv->subdev.name), "%s %s",
> KBUILD_MODNAME, dev_name(&pdev->dev));
> priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
>
> diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c b/drivers/media/platform/ti/omap3isp/ispstat.c
> index 68cf68dbcace..359a846205b0 100644
> --- a/drivers/media/platform/ti/omap3isp/ispstat.c
> +++ b/drivers/media/platform/ti/omap3isp/ispstat.c
> @@ -1039,7 +1039,7 @@ static int isp_stat_init_entities(struct ispstat *stat, const char *name,
> struct media_entity *me = &subdev->entity;
>
> v4l2_subdev_init(subdev, sd_ops);
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "OMAP3 ISP %s", name);
> + snprintf(subdev->name, sizeof(subdev->name), "OMAP3 ISP %s", name);
> subdev->grp_id = BIT(16); /* group ID for isp subdevs */
> subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
> v4l2_set_subdevdata(subdev, stat);
> diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
> index e79657920dc8..9aa72863c213 100644
> --- a/drivers/staging/media/tegra-video/csi.c
> +++ b/drivers/staging/media/tegra-video/csi.c
> @@ -607,10 +607,10 @@ static int tegra_csi_channel_init(struct tegra_csi_channel *chan)
> v4l2_subdev_init(subdev, &tegra_csi_ops);
> subdev->dev = csi->dev;
> if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s-%d", "tpg",
> + snprintf(subdev->name, sizeof(subdev->name), "%s-%d", "tpg",
> chan->csi_port_nums[0]);
> else
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
> + snprintf(subdev->name, sizeof(subdev->name), "%s",
> kbasename(chan->of_node->full_name));
>
> v4l2_set_subdevdata(subdev, chan);
> diff --git a/drivers/staging/media/tegra-video/vip.c b/drivers/staging/media/tegra-video/vip.c
> index 191ecd19a6a7..e95cc7bb190e 100644
> --- a/drivers/staging/media/tegra-video/vip.c
> +++ b/drivers/staging/media/tegra-video/vip.c
> @@ -163,7 +163,7 @@ static int tegra_vip_channel_init(struct tegra_vip *vip)
> subdev = &vip->chan.subdev;
> v4l2_subdev_init(subdev, &tegra_vip_ops);
> subdev->dev = vip->dev;
> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
> + snprintf(subdev->name, sizeof(subdev->name), "%s",
> kbasename(vip->chan.of_node->full_name));
>
> v4l2_set_subdevdata(subdev, &vip->chan);
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 5711354056b9..c1f90c1223a7 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -951,8 +951,6 @@ struct v4l2_subdev_internal_ops {
> void (*release)(struct v4l2_subdev *sd);
> };
>
> -#define V4L2_SUBDEV_NAME_SIZE 52
> -
> /* Set this flag if this subdev is a i2c device. */
> #define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
> /* Set this flag if this subdev is a spi device. */
> @@ -1062,7 +1060,7 @@ struct v4l2_subdev {
> const struct v4l2_subdev_ops *ops;
> const struct v4l2_subdev_internal_ops *internal_ops;
> struct v4l2_ctrl_handler *ctrl_handler;
> - char name[V4L2_SUBDEV_NAME_SIZE];
> + char name[52];
> u32 grp_id;
> void *dev_priv;
> void *host_priv;
> --
> 2.40.1
>
--
Kind Regards,
Niklas Söderlund
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device name size
2023-09-23 15:20 ` [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device " Hans Verkuil
@ 2023-09-24 10:55 ` Sakari Ailus
2023-09-25 6:28 ` Hans Verkuil
0 siblings, 1 reply; 37+ messages in thread
From: Sakari Ailus @ 2023-09-24 10:55 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Arnd Bergmann
Hi Hans,
On Sat, Sep 23, 2023 at 05:20:55PM +0200, Hans Verkuil wrote:
> Increase the size of the name field to prevent a lot of
> string truncate compiler warnings.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
I wonder if there's a way to avoid these otherwise. They still 32
characters when exposed to the user space. Besides --- will the strings
exported to the user space remain "\0"-terminated?
> ---
> include/media/v4l2-dev.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
> index e0a13505f88d..d82dfdbf6e58 100644
> --- a/include/media/v4l2-dev.h
> +++ b/include/media/v4l2-dev.h
> @@ -284,7 +284,7 @@ struct video_device {
> struct v4l2_prio_state *prio;
>
> /* device info */
> - char name[32];
> + char name[64];
> enum vfl_devnode_type vfl_type;
> enum vfl_devnode_direction vfl_dir;
> int minor;
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev name size
2023-09-23 18:11 ` Laurent Pinchart
@ 2023-09-25 6:26 ` Hans Verkuil
2023-09-25 6:51 ` Arnd Bergmann
0 siblings, 1 reply; 37+ messages in thread
From: Hans Verkuil @ 2023-09-25 6:26 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Arnd Bergmann
On 23/09/2023 20:11, Laurent Pinchart wrote:
> Hi Hans,
>
> Thank you for the patch.
>
> On Sat, Sep 23, 2023 at 05:20:56PM +0200, Hans Verkuil wrote:
>> This resolves a lot of the string truncate compiler warnings.
>>
>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>> ---
>> drivers/staging/media/omap4iss/iss_csi2.c | 2 +-
>> include/media/v4l2-subdev.h | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
>> index 04ce0e7eb557..d2844414de4f 100644
>> --- a/drivers/staging/media/omap4iss/iss_csi2.c
>> +++ b/drivers/staging/media/omap4iss/iss_csi2.c
>> @@ -1260,7 +1260,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
>> struct media_pad *pads = csi2->pads;
>> struct media_entity *me = &sd->entity;
>> int ret;
>> - char name[V4L2_SUBDEV_NAME_SIZE];
>> + char name[32];
>>
>> v4l2_subdev_init(sd, &csi2_ops);
>> sd->internal_ops = &csi2_internal_ops;
>> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
>> index 5f59ff0796b7..5711354056b9 100644
>> --- a/include/media/v4l2-subdev.h
>> +++ b/include/media/v4l2-subdev.h
>> @@ -951,7 +951,7 @@ struct v4l2_subdev_internal_ops {
>> void (*release)(struct v4l2_subdev *sd);
>> };
>>
>> -#define V4L2_SUBDEV_NAME_SIZE 32
>> +#define V4L2_SUBDEV_NAME_SIZE 52
>
> Can we allocate it dynamically instead ?
Anything is possible :-)
But that's a separate issue and, I think, should be part of a larger
uAPI discussion. Right now it is just to squash those annoying warnings.
Regards,
Hans
>
>>
>> /* Set this flag if this subdev is a i2c device. */
>> #define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device name size
2023-09-24 10:55 ` Sakari Ailus
@ 2023-09-25 6:28 ` Hans Verkuil
0 siblings, 0 replies; 37+ messages in thread
From: Hans Verkuil @ 2023-09-25 6:28 UTC (permalink / raw)
To: Sakari Ailus; +Cc: linux-media, Arnd Bergmann
On 24/09/2023 12:55, Sakari Ailus wrote:
> Hi Hans,
>
> On Sat, Sep 23, 2023 at 05:20:55PM +0200, Hans Verkuil wrote:
>> Increase the size of the name field to prevent a lot of
>> string truncate compiler warnings.
>>
>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>
> I wonder if there's a way to avoid these otherwise. They still 32
> characters when exposed to the user space. Besides --- will the strings
> exported to the user space remain "\0"-terminated?
Yes, those are always 0 terminated. We are always using either snprintf
or strscpy to write to the 'name' arrays.
Regards,
Hans
>
>> ---
>> include/media/v4l2-dev.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
>> index e0a13505f88d..d82dfdbf6e58 100644
>> --- a/include/media/v4l2-dev.h
>> +++ b/include/media/v4l2-dev.h
>> @@ -284,7 +284,7 @@ struct video_device {
>> struct v4l2_prio_state *prio;
>>
>> /* device info */
>> - char name[32];
>> + char name[64];
>> enum vfl_devnode_type vfl_type;
>> enum vfl_devnode_direction vfl_dir;
>> int minor;
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev name size
2023-09-25 6:26 ` Hans Verkuil
@ 2023-09-25 6:51 ` Arnd Bergmann
0 siblings, 0 replies; 37+ messages in thread
From: Arnd Bergmann @ 2023-09-25 6:51 UTC (permalink / raw)
To: Hans Verkuil, laurent.pinchart; +Cc: linux-media
On Mon, Sep 25, 2023, at 08:26, Hans Verkuil wrote:
> On 23/09/2023 20:11, Laurent Pinchart wrote:
>>>
>>> -#define V4L2_SUBDEV_NAME_SIZE 32
>>> +#define V4L2_SUBDEV_NAME_SIZE 52
>>
>> Can we allocate it dynamically instead ?
>
> Anything is possible :-)
>
> But that's a separate issue and, I think, should be part of a larger
> uAPI discussion. Right now it is just to squash those annoying warnings.
Agreed, and I don't think that dynamic allocation here would
help either on saving memory (because of the slab overhead) or
for correctness (making it even harder for uapi to if there is no
upper bound on the name length).
Arnd
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
2023-09-23 18:06 ` Laurent Pinchart
2023-09-23 19:33 ` Niklas Söderlund
@ 2023-09-25 7:42 ` Maxime Ripard
2023-09-25 16:51 ` Luca Ceresoli
3 siblings, 0 replies; 37+ messages in thread
From: Maxime Ripard @ 2023-09-25 7:42 UTC (permalink / raw)
To: Hans Verkuil
Cc: linux-media, Arnd Bergmann, Laurent Pinchart, Luca Ceresoli,
Maxime Ripard, Niklas Söderlund, Sowjanya Komatineni
On Sat, 23 Sep 2023 17:20:57 +0200, Hans Verkuil wrote:
> Don't rely on a define, let the compiler use the actual
> field size.
>
> Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
> drop the define itself.
>
> [ ... ]
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 18/23] media: am437x: don't fill in bus_info
2023-09-23 15:21 ` [PATCHv2 18/23] media: am437x: don't fill in bus_info Hans Verkuil
@ 2023-09-25 7:45 ` Lad, Prabhakar
0 siblings, 0 replies; 37+ messages in thread
From: Lad, Prabhakar @ 2023-09-25 7:45 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Arnd Bergmann
On Sat, Sep 23, 2023 at 4:21 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
>
> Let the V4L2 core fill this in.
>
> This fixes this warning:
>
> drivers/media/platform/ti/am437x/am437x-vpfe.c: In function 'vpfe_querycap':
> drivers/media/platform/ti/am437x/am437x-vpfe.c:1279:35: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
> 1279 | "platform:%s", vpfe->v4l2_dev.name);
> | ^~
> drivers/media/platform/ti/am437x/am437x-vpfe.c:1278:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
> 1278 | snprintf(cap->bus_info, sizeof(cap->bus_info),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1279 | "platform:%s", vpfe->v4l2_dev.name);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> ---
> drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 ----
> 1 file changed, 4 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Cheers,
Prabhakar
> diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> index 63092013d476..5fa2ea9025d9 100644
> --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> @@ -1271,12 +1271,8 @@ static inline void vpfe_attach_irq(struct vpfe_device *vpfe)
> static int vpfe_querycap(struct file *file, void *priv,
> struct v4l2_capability *cap)
> {
> - struct vpfe_device *vpfe = video_drvdata(file);
> -
> strscpy(cap->driver, VPFE_MODULE_NAME, sizeof(cap->driver));
> strscpy(cap->card, "TI AM437x VPFE", sizeof(cap->card));
> - snprintf(cap->bus_info, sizeof(cap->bus_info),
> - "platform:%s", vpfe->v4l2_dev.name);
> return 0;
> }
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 16/23] media: microchip: don't set bus_info
2023-09-23 15:21 ` [PATCHv2 16/23] media: microchip: don't set bus_info Hans Verkuil
@ 2023-09-25 12:01 ` Nicolas Ferre
0 siblings, 0 replies; 37+ messages in thread
From: Nicolas Ferre @ 2023-09-25 12:01 UTC (permalink / raw)
To: Hans Verkuil, linux-media; +Cc: Arnd Bergmann, Eugen Hristev
On 23/09/2023 at 17:21, Hans Verkuil wrote:
> Let the V4L2 core fill this in.
>
> Fixes these compiler warnings:
>
> drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_querycap':
> drivers/media/platform/microchip/microchip-isc-base.c:486:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
> 486 | "platform:%s", isc->v4l2_dev.name);
> | ^~
> drivers/media/platform/microchip/microchip-isc-base.c:485:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
> 485 | snprintf(cap->bus_info, sizeof(cap->bus_info),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 486 | "platform:%s", isc->v4l2_dev.name);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_mc_init':
> drivers/media/platform/microchip/microchip-isc-base.c:1996:76: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
> 1996 | snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
> | ^~
> drivers/media/platform/microchip/microchip-isc-base.c:1996:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
> 1996 | snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1997 | isc->v4l2_dev.name);
> | ~~~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Eugen Hristev <eugen.hristev@collabora.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
> drivers/media/platform/microchip/microchip-isc-base.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
> index 8dbf7bc1e863..1f8528844497 100644
> --- a/drivers/media/platform/microchip/microchip-isc-base.c
> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
> @@ -478,12 +478,8 @@ static const struct vb2_ops isc_vb2_ops = {
> static int isc_querycap(struct file *file, void *priv,
> struct v4l2_capability *cap)
> {
> - struct isc_device *isc = video_drvdata(file);
> -
> strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
> strscpy(cap->card, "Microchip Image Sensor Controller", sizeof(cap->card));
> - snprintf(cap->bus_info, sizeof(cap->bus_info),
> - "platform:%s", isc->v4l2_dev.name);
>
> return 0;
> }
> @@ -1993,8 +1989,6 @@ int isc_mc_init(struct isc_device *isc, u32 ver)
> strscpy(isc->mdev.driver_name, KBUILD_MODNAME,
> sizeof(isc->mdev.driver_name));
> strscpy(isc->mdev.model, match->compatible, sizeof(isc->mdev.model));
> - snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
> - isc->v4l2_dev.name);
> isc->mdev.hw_revision = ver;
>
> media_device_init(&isc->mdev);
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 19/23] media: atmel: drop bus_info
2023-09-23 15:21 ` [PATCHv2 19/23] media: atmel: drop bus_info Hans Verkuil
@ 2023-09-25 12:01 ` Nicolas Ferre
0 siblings, 0 replies; 37+ messages in thread
From: Nicolas Ferre @ 2023-09-25 12:01 UTC (permalink / raw)
To: Hans Verkuil, linux-media; +Cc: Arnd Bergmann, Eugen Hristev
On 23/09/2023 at 17:21, Hans Verkuil wrote:
> Let the V4L2 core fill this in.
>
> Fixes this warning:
>
> drivers/staging/media/deprecated/atmel/atmel-isc-base.c: In function 'isc_querycap':
> drivers/staging/media/deprecated/atmel/atmel-isc-base.c:496:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
> 496 | "platform:%s", isc->v4l2_dev.name);
> | ^~
> drivers/staging/media/deprecated/atmel/atmel-isc-base.c:495:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
> 495 | snprintf(cap->bus_info, sizeof(cap->bus_info),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 496 | "platform:%s", isc->v4l2_dev.name);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Eugen Hristev <eugen.hristev@collabora.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Thanks Hans for having take care of this for ISI and ISC. Best regards,
Nicolas
> ---
> drivers/staging/media/deprecated/atmel/atmel-isc-base.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/staging/media/deprecated/atmel/atmel-isc-base.c b/drivers/staging/media/deprecated/atmel/atmel-isc-base.c
> index f5d963904201..8e26663cecb6 100644
> --- a/drivers/staging/media/deprecated/atmel/atmel-isc-base.c
> +++ b/drivers/staging/media/deprecated/atmel/atmel-isc-base.c
> @@ -488,12 +488,8 @@ static const struct vb2_ops isc_vb2_ops = {
> static int isc_querycap(struct file *file, void *priv,
> struct v4l2_capability *cap)
> {
> - struct isc_device *isc = video_drvdata(file);
> -
> strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
> strscpy(cap->card, "Atmel Image Sensor Controller", sizeof(cap->card));
> - snprintf(cap->bus_info, sizeof(cap->bus_info),
> - "platform:%s", isc->v4l2_dev.name);
>
> return 0;
> }
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
` (2 preceding siblings ...)
2023-09-25 7:42 ` Maxime Ripard
@ 2023-09-25 16:51 ` Luca Ceresoli
2023-09-26 10:29 ` Luca Ceresoli
3 siblings, 1 reply; 37+ messages in thread
From: Luca Ceresoli @ 2023-09-25 16:51 UTC (permalink / raw)
To: Hans Verkuil
Cc: linux-media, Arnd Bergmann, Maxime Ripard, Niklas Söderlund,
Sowjanya Komatineni, Laurent Pinchart
Hi Hans,
On Sat, 23 Sep 2023 17:20:57 +0200
Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
> Don't rely on a define, let the compiler use the actual
> field size.
>
> Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
> drop the define itself.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Cc: Sowjanya Komatineni <skomatineni@nvidia.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/i2c/msp3400-driver.c | 2 +-
> drivers/media/platform/cadence/cdns-csi2rx.c | 4 ++--
> drivers/media/platform/cadence/cdns-csi2tx.c | 4 ++--
> drivers/media/platform/renesas/rcar-isp.c | 2 +-
> drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 2 +-
> drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
> drivers/staging/media/tegra-video/csi.c | 4 ++--
> drivers/staging/media/tegra-video/vip.c | 2 +-
For tegra-video:
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
I wanted to test it to be extra safe but discovered a regression that
broke probing of the VI driver, so I am now investigating that.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE
2023-09-25 16:51 ` Luca Ceresoli
@ 2023-09-26 10:29 ` Luca Ceresoli
0 siblings, 0 replies; 37+ messages in thread
From: Luca Ceresoli @ 2023-09-26 10:29 UTC (permalink / raw)
To: Hans Verkuil
Cc: linux-media, Arnd Bergmann, Maxime Ripard, Niklas Söderlund,
Sowjanya Komatineni, Laurent Pinchart
On Mon, 25 Sep 2023 18:51:57 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> Hi Hans,
>
> On Sat, 23 Sep 2023 17:20:57 +0200
> Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
>
> > Don't rely on a define, let the compiler use the actual
> > field size.
> >
> > Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
> > drop the define itself.
> >
> > Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> > Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > Cc: Sowjanya Komatineni <skomatineni@nvidia.com>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > drivers/media/i2c/msp3400-driver.c | 2 +-
> > drivers/media/platform/cadence/cdns-csi2rx.c | 4 ++--
> > drivers/media/platform/cadence/cdns-csi2tx.c | 4 ++--
> > drivers/media/platform/renesas/rcar-isp.c | 2 +-
> > drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 2 +-
> > drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
> > drivers/staging/media/tegra-video/csi.c | 4 ++--
> > drivers/staging/media/tegra-video/vip.c | 2 +-
>
> For tegra-video:
> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
And now also (for patches 11 and 12 as well):
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # tegra-video VIP
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2023-09-26 10:29 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23 15:20 [PATCHv2 00/23] media: fix all string truncate warnings Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 01/23] media: allegro-dvt: increase buffer size in msg_type_name() Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 02/23] media: cadence: increase buffer size in csi2tx_get_resources() Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 03/23] media: atomisp: ia_ccs_debug.c: increase enable_info buffer Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 04/23] media: vivid: avoid integer overflow Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 05/23] media: ipu-bridge: increase sensor_name size Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 06/23] media: cx18: increase in_workq_name size Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 07/23] media: rc: ati_remote: increase mouse_name buffer size Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 08/23] media: cec.h: increase input_phys buffer Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 09/23] media: renesas-ceu: keep input name simple Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 10/23] media: zoran: increase name size Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 11/23] media: v4l2-dev.h: increase struct video_device " Hans Verkuil
2023-09-24 10:55 ` Sakari Ailus
2023-09-25 6:28 ` Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 12/23] media: v4l2-subdev.h: increase struct v4l2_subdev " Hans Verkuil
2023-09-23 18:11 ` Laurent Pinchart
2023-09-25 6:26 ` Hans Verkuil
2023-09-25 6:51 ` Arnd Bergmann
2023-09-23 15:20 ` [PATCHv2 13/23] media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE Hans Verkuil
2023-09-23 18:06 ` Laurent Pinchart
2023-09-23 19:33 ` Niklas Söderlund
2023-09-25 7:42 ` Maxime Ripard
2023-09-25 16:51 ` Luca Ceresoli
2023-09-26 10:29 ` Luca Ceresoli
2023-09-23 15:20 ` [PATCHv2 14/23] media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE Hans Verkuil
2023-09-23 15:20 ` [PATCHv2 15/23] media: vivid: use VIVID_MODULE_NAME to fill bus_info Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 16/23] media: microchip: don't set bus_info Hans Verkuil
2023-09-25 12:01 ` Nicolas Ferre
2023-09-23 15:21 ` [PATCHv2 17/23] media: rcar_drif: use explicit name for bus_info Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 18/23] media: am437x: don't fill in bus_info Hans Verkuil
2023-09-25 7:45 ` Lad, Prabhakar
2023-09-23 15:21 ` [PATCHv2 19/23] media: atmel: drop bus_info Hans Verkuil
2023-09-25 12:01 ` Nicolas Ferre
2023-09-23 15:21 ` [PATCHv2 20/23] media: radio-isa: use dev_name to fill in bus_info Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 21/23] media: radio-miropcm20: set bus_info to explicit name Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 22/23] media: verisilicon: replace snprintf with strscpy+strlcat Hans Verkuil
2023-09-23 15:21 ` [PATCHv2 23/23] media: radio-si476x: don't fill in bus_info Hans Verkuil
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).