Message ID | 20230923152107.283289-12-hverkuil-cisco@xs4all.nl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: fix all string truncate warnings | expand |
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;
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; >
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;
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(-)