Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

c2port: annotate bitfield for kmemcheck

This silences a false positive warning with kmemcheck.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>

+5
+2
drivers/misc/c2port/core.c
··· 15 15 #include <linux/errno.h> 16 16 #include <linux/err.h> 17 17 #include <linux/kernel.h> 18 + #include <linux/kmemcheck.h> 18 19 #include <linux/ctype.h> 19 20 #include <linux/delay.h> 20 21 #include <linux/idr.h> ··· 892 891 return ERR_PTR(-EINVAL); 893 892 894 893 c2dev = kmalloc(sizeof(struct c2port_device), GFP_KERNEL); 894 + kmemcheck_annotate_bitfield(c2dev, flags); 895 895 if (unlikely(!c2dev)) 896 896 return ERR_PTR(-ENOMEM); 897 897
+3
include/linux/c2port.h
··· 10 10 */ 11 11 12 12 #include <linux/device.h> 13 + #include <linux/kmemcheck.h> 13 14 14 15 #define C2PORT_NAME_LEN 32 15 16 ··· 21 20 /* Main struct */ 22 21 struct c2port_ops; 23 22 struct c2port_device { 23 + kmemcheck_bitfield_begin(flags); 24 24 unsigned int access:1; 25 25 unsigned int flash_access:1; 26 + kmemcheck_bitfield_end(flags); 26 27 27 28 int id; 28 29 char name[C2PORT_NAME_LEN];