[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202303282152.CXxK3RNH-lkp@intel.com>
Date: Tue, 28 Mar 2023 21:28:06 +0800
From: kernel test robot <lkp@...el.com>
To: Wei Chen <harperchen1110@...il.com>, tiffany.lin@...iatek.com
Cc: oe-kbuild-all@...ts.linux.dev, andrew-ct.chen@...iatek.com,
yunfei.dong@...iatek.com, mchehab@...nel.org,
matthias.bgg@...il.com, angelogioacchino.delregno@...labora.com,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Wei Chen <harperchen1110@...il.com>
Subject: Re: [PATCH] media: mediatek: vcodec: Fix potential array
out-of-bounds in decoder queue_setup
Hi Wei,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on media-tree/master]
[also build test WARNING on linus/master v6.3-rc4 next-20230328]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wei-Chen/media-mediatek-vcodec-Fix-potential-array-out-of-bounds-in-decoder-queue_setup/20230328-181142
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/20230328100951.536955-1-harperchen1110%40gmail.com
patch subject: [PATCH] media: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup
config: riscv-allmodconfig (https://download.01.org/0day-ci/archive/20230328/202303282152.CXxK3RNH-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/caa43627286fb5f3b0b3af7e01e1baeca5c5f9cc
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Wei-Chen/media-mediatek-vcodec-Fix-potential-array-out-of-bounds-in-decoder-queue_setup/20230328-181142
git checkout caa43627286fb5f3b0b3af7e01e1baeca5c5f9cc
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/media/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303282152.CXxK3RNH-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c: In function 'vb2ops_vdec_queue_setup':
>> drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c:756:20: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
756 | if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
| ^
vim +/else +756 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
739
740 int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
741 unsigned int *nplanes, unsigned int sizes[],
742 struct device *alloc_devs[])
743 {
744 struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vq);
745 struct mtk_q_data *q_data;
746 unsigned int i;
747
748 q_data = mtk_vdec_get_q_data(ctx, vq->type);
749
750 if (q_data == NULL) {
751 mtk_v4l2_err("vq->type=%d err\n", vq->type);
752 return -EINVAL;
753 }
754
755 if (*nplanes) {
> 756 if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
757 if (*nplanes != q_data->fmt->num_planes)
758 return -EINVAL;
759 else
760 if (*nplanes != 1)
761 return -EINVAL;
762
763 for (i = 0; i < *nplanes; i++) {
764 if (sizes[i] < q_data->sizeimage[i])
765 return -EINVAL;
766 }
767 } else {
768 if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
769 *nplanes = q_data->fmt->num_planes;
770 else
771 *nplanes = 1;
772
773 for (i = 0; i < *nplanes; i++)
774 sizes[i] = q_data->sizeimage[i];
775 }
776
777 mtk_v4l2_debug(1,
778 "[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x ",
779 ctx->id, vq->type, *nplanes, *nbuffers,
780 sizes[0], sizes[1]);
781
782 return 0;
783 }
784
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Powered by blists - more mailing lists