== Series Details == Series: Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation URL : https://patchwork.freedesktop.org/series/107615/ State : warning == Summary == Error: dim checkpatch failed 5b7f7fd11ece overflow: Move and add few utility macros into overflow -:122: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'x' - possible side-effects? #122: FILE: include/linux/overflow.h:91: +#define overflows_ptr(x, T) __must_check_overflow(({ \ + typecheck_pointer(T); \ + ((x) < 0) ? 1 : (sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T)) ? 1 : 0; \ +})) -:122: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'T' - possible side-effects? #122: FILE: include/linux/overflow.h:91: +#define overflows_ptr(x, T) __must_check_overflow(({ \ + typecheck_pointer(T); \ + ((x) < 0) ? 1 : (sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T)) ? 1 : 0; \ +})) -:148: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'ptr' - possible side-effects? #148: FILE: include/linux/overflow.h:117: +#define check_assign(value, ptr) __must_check_overflow(({ \ + typecheck_pointer(ptr); \ + __builtin_add_overflow(0, value, ptr); \ +})) -:149: WARNING:SPACE_BEFORE_TAB: please, no space before tabs #149: FILE: include/linux/overflow.h:118: +^Itypecheck_pointer(ptr); ^I^I\$ total: 0 errors, 1 warnings, 3 checks, 98 lines checked 9a428eab6305 util_macros: Add exact_type macro to catch type mis-match while compiling 278009000b9f drm/i915/gem: Typecheck page lookups -:141: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #141: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:413: +#define i915_gem_object_page_iter_get_sg(obj, it, n, offset) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_page_iter_get_sg(obj, it, n, offset); \ +}) -:190: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #190: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:458: +#define i915_gem_object_get_sg(obj, n, offset) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_get_sg(obj, n, offset); \ +}) -:239: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #239: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:503: +#define i915_gem_object_get_sg_dma(obj, n, offset) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_get_sg_dma(obj, n, offset); \ +}) -:277: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #277: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:539: +#define i915_gem_object_get_page(obj, n) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_get_page(obj, n); \ +}) -:314: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #314: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:574: +#define i915_gem_object_get_dirty_page(obj, n) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_get_dirty_page(obj, n); \ +}) -:355: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #355: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:612: +#define i915_gem_object_get_dma_address_len(obj, n, len) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_get_dma_address_len(obj, n, len); \ +}) -:392: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects? #392: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.h:647: +#define i915_gem_object_get_dma_address(obj, n) ({ \ + exactly_pgoff_t(n); \ + __i915_gem_object_get_dma_address(obj, n); \ +}) total: 0 errors, 0 warnings, 7 checks, 623 lines checked 596989805ffb drm/i915: Check for integer truncation on scatterlist creation -:204: WARNING:NEW_TYPEDEFS: do not add new typedefs #204: FILE: drivers/gpu/drm/i915/i915_scatterlist.h:224: +typedef unsigned int __sg_size_t; /* see linux/scatterlist.h */ -:205: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #205: FILE: drivers/gpu/drm/i915/i915_scatterlist.h:225: +#define sg_alloc_table(sgt, nents, gfp) \ + overflows_type(nents, __sg_size_t) ? -E2BIG \ + : ((sg_alloc_table)(sgt, (__sg_size_t)(nents), gfp)) -:205: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'nents' - possible side-effects? #205: FILE: drivers/gpu/drm/i915/i915_scatterlist.h:225: +#define sg_alloc_table(sgt, nents, gfp) \ + overflows_type(nents, __sg_size_t) ? -E2BIG \ + : ((sg_alloc_table)(sgt, (__sg_size_t)(nents), gfp)) -:209: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #209: FILE: drivers/gpu/drm/i915/i915_scatterlist.h:229: +#define sg_alloc_table_from_pages_segment(sgt, pages, npages, offset, size, max_segment, gfp) \ + overflows_type(npages, __sg_size_t) ? -E2BIG \ + : ((sg_alloc_table_from_pages_segment)(sgt, pages, (__sg_size_t)(npages), offset, \ + size, max_segment, gfp)) -:209: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'npages' - possible side-effects? #209: FILE: drivers/gpu/drm/i915/i915_scatterlist.h:229: +#define sg_alloc_table_from_pages_segment(sgt, pages, npages, offset, size, max_segment, gfp) \ + overflows_type(npages, __sg_size_t) ? -E2BIG \ + : ((sg_alloc_table_from_pages_segment)(sgt, pages, (__sg_size_t)(npages), offset, \ + size, max_segment, gfp)) total: 2 errors, 1 warnings, 2 checks, 126 lines checked d2376e30f655 drm/i915: Check for integer truncation on the configuration of ttm place 60cb3ac0de79 drm/i915: Check if the size is too big while creating shmem file bef81bc7ee40 drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large -:11: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #11: to add vma. The direct function that returns -ENOSPC is drm_mm_insert_node_in_range(). total: 0 errors, 1 warnings, 0 checks, 17 lines checked 29fd7ba1ef7e drm/i915: Remove truncation warning for large objects