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