# git rev-parse -q --verify 07a9d6cdcca83271b0ba04ec0d333cd9cd352a51^{commit} 07a9d6cdcca83271b0ba04ec0d333cd9cd352a51 already have revision, skipping fetch # git checkout -q -f -B kisskb 07a9d6cdcca83271b0ba04ec0d333cd9cd352a51 # git clean -qxdf # < git log -1 # commit 07a9d6cdcca83271b0ba04ec0d333cd9cd352a51 # Author: Gustavo A. R. Silva # Date: Wed Aug 7 11:42:29 2019 -0500 # # perf/x86/intel/uncore: Use struct_size() in kzalloc_node() # # One of the more common cases of allocation size calculations is finding # the size of a structure that has a zero-sized array at the end, along # with memory for some number of elements for that array. For example: # # struct intel_uncore_box { # ... # struct intel_uncore_extra_reg shared_regs[0]; # }; # # size = sizeof(struct intel_uncore_box) + count * sizeof(struct intel_uncore_extra_reg); # instance = kzalloc_node(size, GFP_KERNEL, node); # # Instead of leaving these open-coded and prone to type mistakes, we can # now use the new struct_size() helper: # # instance = kzalloc_node(struct_size(instance, shared_regs, count), GFP_KERNEL, # node); # # Notice that, in this case, variable size is not necessary, hence it # is removed. # # This code was detected with the help of Coccinelle. # # Signed-off-by: Gustavo A. R. Silva # < /opt/cross/kisskb/gcc-4.6.3-nolibc/alpha-linux/bin/alpha-linux-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/alpha-linux/bin/alpha-linux-ld --version # < git log --format=%s --max-count=1 07a9d6cdcca83271b0ba04ec0d333cd9cd352a51 # < make -s -j 8 ARCH=alpha O=/kisskb/build/gustavoars_alpha-defconfig_alpha CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/alpha-linux/bin/alpha-linux- defconfig # make -s -j 8 ARCH=alpha O=/kisskb/build/gustavoars_alpha-defconfig_alpha CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/alpha-linux/bin/alpha-linux- :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:194:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:338:21: note: 'pdeo' was declared here WARNING: "saved_config" [vmlinux] is COMMON symbol Kernel arch/alpha/boot/vmlinux.gz is ready Completed OK # rm -rf /kisskb/build/gustavoars_alpha-defconfig_alpha # Build took: 0:01:30.266800