✓ CI.checkpatch: success for drm/xe: Prefer struct_size over open coded arithmetic

Patchwork patchwork at emeril.freedesktop.org
Mon Feb 12 16:15:17 UTC 2024


== Series Details ==

Series: drm/xe: Prefer struct_size over open coded arithmetic
URL   : https://patchwork.freedesktop.org/series/129775/
State : success

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt
Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master
35591fb8b4d5305b37ce31483f85ac0956eaa536
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 317c76c221fe5f8e96416bd56c05f614570ee81e
Author: Erick Archer <erick.archer at gmx.com>
Date:   Sat Feb 10 15:19:12 2024 +0100

    drm/xe: Prefer struct_size over open coded arithmetic
    
    This is an effort to get rid of all multiplications from allocation
    functions in order to prevent integer overflows [1].
    
    As the "q" variable is a pointer to "struct xe_exec_queue" and this
    structure ends in a flexible array:
    
    struct xe_exec_queue {
            [...]
            struct xe_lrc lrc[];
    };
    
    the preferred way in the kernel is to use the struct_size() helper to
    do the arithmetic instead of the argument "size + size * count" in the
    kzalloc() function.
    
    This way, the code is more readable and more safer.
    
    Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
    Link: https://github.com/KSPP/linux/issues/160 [2]
    Signed-off-by: Erick Archer <erick.archer at gmx.com>
+ /mt/dim checkpatch 46cf1a7da57fc4fd2306d52aea58a02c7eb06cce drm-intel
317c76c22 drm/xe: Prefer struct_size over open coded arithmetic




More information about the Intel-xe mailing list