lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 27 Mar 2021 14:32:49 +0000
From:   Mirela Rabulea <mirela.rabulea@....com>
To:     dl-linux-imx <linux-imx@....com>,
        "colin.king@...onical.com" <colin.king@...onical.com>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "festevam@...il.com" <festevam@...il.com>,
        "mchehab@...nel.org" <mchehab@...nel.org>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>,
        "hverkuil-cisco@...all.nl" <hverkuil-cisco@...all.nl>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [EXT] [PATCH][next] media: imx-jpeg: Pass the v4l2_jpeg_header
 header argument by reference

Hi,

On Tue, 2021-03-23 at 14:24 +0000, Colin King wrote:
> 
> From: Colin Ian King <colin.king@...onical.com>
> 
> Currently the header argument is being passed by value, so a copy of
> 256
> byte structure on the stack is potentially occurring. Fix this by
> passing
> by reference to avoid any large stack copies.
> 
> Addresses-Coverity: ("Big parameter passed by value")
> Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG
> Encoder/Decoder")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/media/platform/imx-jpeg/mxc-jpeg.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> index adb1715c75d7..f13a8efc35ad 100644
> --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> @@ -1114,21 +1114,21 @@ static int mxc_jpeg_valid_comp_id(struct
> device *dev,
>  }
> 
>  static u32 mxc_jpeg_get_image_format(struct device *dev,
> -                                    const struct v4l2_jpeg_header
> header)
> +                                    const struct v4l2_jpeg_header
> *header)
>  {
>         int i;
>         u32 fourcc = 0;
> 
>         for (i = 0; i < MXC_JPEG_NUM_FORMATS; i++)
> -               if (mxc_formats[i].subsampling ==
> header.frame.subsampling &&
> -                   mxc_formats[i].nc == header.frame.num_components)
> {
> +               if (mxc_formats[i].subsampling == header-
> >frame.subsampling &&
> +                   mxc_formats[i].nc == header-
> >frame.num_components) {
>                         fourcc = mxc_formats[i].fourcc;
>                         break;
>                 }
>         if (fourcc == 0) {
>                 dev_err(dev, "Could not identify image format nc=%d,
> subsampling=%d\n",
> -                       header.frame.num_components,
> -                       header.frame.subsampling);
> +                       header->frame.num_components,
> +                       header->frame.subsampling);
>                 return fourcc;
>         }
>         /*
> @@ -1137,7 +1137,7 @@ static u32 mxc_jpeg_get_image_format(struct
> device *dev,
>          * ITU-T T.872 chapter 6.5.3 APP14 marker segment for colour
> encoding
>          */
>         if (fourcc == V4L2_PIX_FMT_YUV24 || fourcc ==
> V4L2_PIX_FMT_RGB24) {
> -               if (header.app14_tf == V4L2_JPEG_APP14_TF_CMYK_RGB)
> +               if (header->app14_tf == V4L2_JPEG_APP14_TF_CMYK_RGB)
>                         fourcc = V4L2_PIX_FMT_RGB24;
>                 else
>                         fourcc = V4L2_PIX_FMT_YUV24;
> @@ -1258,7 +1258,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx
> *ctx,
>         if (!mxc_jpeg_valid_comp_id(dev, psof, psos))
>                 dev_warn(dev, "JPEG component ids should be 0-3 or 1-
> 4");
> 
> -       fourcc = mxc_jpeg_get_image_format(dev, header);
> +       fourcc = mxc_jpeg_get_image_format(dev, &header);
>         if (fourcc == 0)
>                 return -EINVAL;
> 
> --
> 2.30.2
> 
Thanks for the patch.

Reviewed-by: Mirela Rabulea <mirela.rabulea@....com>

Regards,
Mirela

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ