Hi Lionel, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm-intel/for-linux-next] [cannot apply to v5.3-rc7 next-20190902] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Lionel-Landwerlin/drm-i915-Vulkan-performance-query-support/20190831-033234 base: git://anongit.freedesktop.org/drm-intel for-linux-next If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> New smatch warnings: drivers/gpu/drm/i915/i915_query.c:405 query_perf_config_list() warn: maybe return -EFAULT instead of the bytes remaining? Old smatch warnings: drivers/gpu/drm/i915/i915_query.c:138 query_engine_info() warn: check that 'query.num_engines' doesn't leak information # https://github.com/0day-ci/linux/commit/1c566ee2d38f4e7ece15ee33fef205b1088e79bb git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 1c566ee2d38f4e7ece15ee33fef205b1088e79bb vim +405 drivers/gpu/drm/i915/i915_query.c 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 336 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 337 static int query_perf_config_list(struct drm_i915_private *i915, 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 338 struct drm_i915_query_item *query_item) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 339 { 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 340 struct drm_i915_query_perf_config __user *user_query_config_ptr = 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 341 u64_to_user_ptr(query_item->data_ptr); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 342 struct i915_oa_config *oa_config; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 343 u32 flags, total_size; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 344 u64 i, n_configs, *oa_config_ids; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 345 int ret, id; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 346 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 347 if (!i915->perf.initialized) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 348 return -ENODEV; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 349 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 350 /* Count the default test configuration */ 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 351 n_configs = i915->perf.n_metrics + 1; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 352 total_size = sizeof(struct drm_i915_query_perf_config) + 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 353 sizeof(u64) * n_configs; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 354 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 355 if (query_item->length == 0) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 356 return total_size; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 357 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 358 if (query_item->length < total_size) { 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 359 DRM_DEBUG("Invalid query config list item size=%u expected=%u\n", 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 360 query_item->length, total_size); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 361 return -EINVAL; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 362 } 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 363 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 364 if (!access_ok(user_query_config_ptr, total_size)) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 365 return -EFAULT; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 366 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 367 if (__get_user(flags, &user_query_config_ptr->flags)) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 368 return -EFAULT; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 369 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 370 if (flags != 0) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 371 return -EINVAL; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 372 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 373 if (__put_user(n_configs, &user_query_config_ptr->config)) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 374 return -EFAULT; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 375 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 376 ret = mutex_lock_interruptible(&i915->perf.metrics_lock); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 377 if (ret) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 378 return ret; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 379 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 380 /* Count the configs. */ 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 381 n_configs = 1; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 382 idr_for_each_entry(&i915->perf.metrics_idr, oa_config, id) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 383 n_configs++; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 384 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 385 oa_config_ids = 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 386 kmalloc_array(n_configs, sizeof(*oa_config_ids), GFP_KERNEL); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 387 if (!oa_config_ids) { 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 388 mutex_unlock(&i915->perf.metrics_lock); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 389 return -ENOMEM; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 390 } 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 391 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 392 i = 0; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 393 oa_config_ids[i++] = 1ull; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 394 idr_for_each_entry(&i915->perf.metrics_idr, oa_config, id) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 395 oa_config_ids[i++] = id; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 396 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 397 mutex_unlock(&i915->perf.metrics_lock); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 398 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 399 ret = copy_to_user(u64_to_user_ptr(query_item->data_ptr + 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 400 sizeof(struct drm_i915_query_perf_config)), 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 401 oa_config_ids, 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 402 n_configs * sizeof(*oa_config_ids)); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 403 kfree(oa_config_ids); 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 404 if (ret) 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 @405 return ret; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 406 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 407 return total_size; 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 408 } 1c566ee2d38f4e Lionel Landwerlin 2019-08-30 409 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx