Commit c53bd2e1949ddbe06fe2a6079c0658d58ce25edb
1 parent
9e337b0fb3
Exists in
master
and in
7 other branches
c2port: annotate bitfield for kmemcheck
This silences a false positive warning with kmemcheck. Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Showing 2 changed files with 5 additions and 0 deletions Side-by-side Diff
drivers/misc/c2port/core.c
... | ... | @@ -15,6 +15,7 @@ |
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> |
... | ... | @@ -891,6 +892,7 @@ |
891 | 892 | return ERR_PTR(-EINVAL); |
892 | 893 | |
893 | 894 | c2dev = kmalloc(sizeof(struct c2port_device), GFP_KERNEL); |
895 | + kmemcheck_annotate_bitfield(c2dev, flags); | |
894 | 896 | if (unlikely(!c2dev)) |
895 | 897 | return ERR_PTR(-ENOMEM); |
896 | 898 |
include/linux/c2port.h
... | ... | @@ -10,6 +10,7 @@ |
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 | |
16 | 17 | |
... | ... | @@ -20,8 +21,10 @@ |
20 | 21 | /* Main struct */ |
21 | 22 | struct c2port_ops; |
22 | 23 | struct c2port_device { |
24 | + kmemcheck_bitfield_begin(flags); | |
23 | 25 | unsigned int access:1; |
24 | 26 | unsigned int flash_access:1; |
27 | + kmemcheck_bitfield_end(flags); | |
25 | 28 | |
26 | 29 | int id; |
27 | 30 | char name[C2PORT_NAME_LEN]; |