[xilinx-xlnx:master 586/587] drivers/gpu/drm/xlnx/xlnx_mixer.c:2216:9: warning: 'strncpy' specified bound 4 equals destination size
kernel test robot
lkp at intel.com
Tue Jun 21 11:42:55 PDT 2022
tree: https://github.com/Xilinx/linux-xlnx master
head: d152c7d3b7f02c4517cd20098140cfe4ac61179e
commit: 51922bbe4bd943daf9b5684f7deb87ffe82c00a2 [586/587] drm: xlnx: mixer: Correct the fourcc string copy
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20220622/202206220204.ZdQS6kJi-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.3.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/Xilinx/linux-xlnx/commit/51922bbe4bd943daf9b5684f7deb87ffe82c00a2
git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
git fetch --no-tags xilinx-xlnx master
git checkout 51922bbe4bd943daf9b5684f7deb87ffe82c00a2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/gpu/drm/xlnx/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp at intel.com>
All warnings (new ones prefixed by >>):
drivers/gpu/drm/xlnx/xlnx_mixer.c: In function 'xlnx_mix_parse_dt_bg_video_fmt':
>> drivers/gpu/drm/xlnx/xlnx_mixer.c:2216:9: warning: 'strncpy' specified bound 4 equals destination size [-Wstringop-truncation]
2216 | strncpy((char *)&layer->hw_config.vid_fmt, vformat, 4);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/xlnx/xlnx_mixer.c: In function 'xlnx_mix_of_init_layer':
drivers/gpu/drm/xlnx/xlnx_mixer.c:2493:9: warning: 'strncpy' specified bound 4 equals destination size [-Wstringop-truncation]
2493 | strncpy((char *)&layer->hw_config.vid_fmt, vformat, 4);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +2216 drivers/gpu/drm/xlnx/xlnx_mixer.c
2194
2195 static int xlnx_mix_parse_dt_bg_video_fmt(struct device_node *node,
2196 struct xlnx_mix_hw *mixer_hw)
2197 {
2198 struct device_node *layer_node;
2199 struct xlnx_mix_layer_data *layer;
2200 const char *vformat;
2201
2202 layer_node = of_get_child_by_name(node, "layer_0");
2203 layer = &mixer_hw->layer_data[XVMIX_MASTER_LAYER_IDX];
2204
2205 /* Set default values */
2206 layer->hw_config.can_alpha = false;
2207 layer->hw_config.can_scale = false;
2208 layer->hw_config.min_width = XVMIX_LAYER_WIDTH_MIN;
2209 layer->hw_config.min_height = XVMIX_LAYER_HEIGHT_MIN;
2210
2211 if (of_property_read_string(layer_node, "xlnx,vformat",
2212 &vformat)) {
2213 DRM_ERROR("No xlnx,vformat value for layer 0 in dts\n");
2214 return -EINVAL;
2215 }
> 2216 strncpy((char *)&layer->hw_config.vid_fmt, vformat, 4);
2217 layer->hw_config.is_streaming =
2218 of_property_read_bool(layer_node, "xlnx,layer-streaming");
2219 if (of_property_read_u32(node, "xlnx,bpc", &mixer_hw->bg_layer_bpc)) {
2220 DRM_ERROR("Failed to get bits per component (bpc) prop\n");
2221 return -EINVAL;
2222 }
2223 if (of_property_read_u32(layer_node, "xlnx,layer-max-width",
2224 &layer->hw_config.max_width)) {
2225 DRM_ERROR("Failed to get screen width prop\n");
2226 return -EINVAL;
2227 } else if (layer->hw_config.max_width > XVMIX_DISP_MAX_WIDTH ||
2228 layer->hw_config.max_width < XVMIX_DISP_MIN_WIDTH) {
2229 DRM_ERROR("Invalid width in dt");
2230 return -EINVAL;
2231 }
2232
2233 mixer_hw->max_layer_width = layer->hw_config.max_width;
2234 if (of_property_read_u32(layer_node, "xlnx,layer-max-height",
2235 &layer->hw_config.max_height)) {
2236 DRM_ERROR("Failed to get screen height prop\n");
2237 return -EINVAL;
2238 } else if (layer->hw_config.max_height > XVMIX_DISP_MAX_HEIGHT ||
2239 layer->hw_config.max_height < XVMIX_DISP_MIN_HEIGHT) {
2240 DRM_ERROR("Invalid height in dt");
2241 return -EINVAL;
2242 }
2243
2244 mixer_hw->max_layer_height = layer->hw_config.max_height;
2245 layer->id = XVMIX_LAYER_MASTER;
2246
2247 return 0;
2248 }
2249
--
0-DAY CI Kernel Test Service
https://01.org/lkp
More information about the linux-arm-kernel
mailing list